view src/lib/safe-memset.c @ 22713:cb108f786fb4

Updated copyright notices to include the year 2018.
author Stephan Bosch <stephan.bosch@dovecot.fi>
date Mon, 01 Jan 2018 22:42:08 +0100
parents 2e2563132d5f
children
line wrap: on
line source

/* Copyright (c) 2002-2018 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "safe-memset.h"

void safe_memset(void *data, int c, size_t size)
{
	volatile unsigned int volatile_zero_idx = 0;
	volatile unsigned char *p = data;

	if (size == 0)
		return;

	do {
		memset(data, c, size);
	} while (p[volatile_zero_idx] != c);
}