From 64ff684754528632c4d4908d5fa2b78c40f60212 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Mon, 23 Dec 2013 18:04:06 +0100 Subject: [PATCH] Fix gcc warning -Wsizeof-pointer-memaccess MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/iodined.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iodined.c b/src/iodined.c index b3b0607..8fcbe00 100644 --- a/src/iodined.c +++ b/src/iodined.c @@ -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';