1
0
mirror of https://github.com/yarrick/iodine.git synced 2024-11-25 14:36:05 +03:00

Fix gcc warning -Wsizeof-pointer-memaccess

iodined.c: In function ‘write_dns_nameenc’:
iodined.c:2030:23: attention : argument to ‘sizeof’ in ‘memset’ call is the same
expression as the destination; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]
  memset(buf, 0, sizeof(buf));

sizeof buf will just give the size of the pointer, while buflen will clean the whole
memory.
This commit is contained in:
Michael Scherer 2013-12-23 18:04:06 +01:00
parent 59dbaf2b50
commit 64ff684754

View File

@ -2023,7 +2023,7 @@ write_dns_nameenc(char *buf, size_t buflen, char *data, int datalen, char downen
space = MIN(0xFF, buflen) - 4 - 2;
/* -1 encoding type, -3 ".xy", -2 for safety */
memset(buf, 0, sizeof(buf));
memset(buf, 0, buflen);
if (downenc == 'S') {
buf[0] = 'i';