[Olsr-dev] [PATCH v1 01/12] win32: fix uninitialized variable when building with DEBUG=0 OPTIMIZE=-O2

Ferry Huberts (spam-protected)
Tue May 29 15:59:30 CEST 2012


From: Ferry Huberts <(spam-protected)>

src/win32/compat.c: In function 'inet_ntop':
src/win32/compat.c:437:25: error: 'best.len' may be used uninitialized in this function [-Werror=uninitialized]
src/win32/compat.c:403:5: note: 'best.len' was declared here

Signed-off-by: Ferry Huberts <(spam-protected)>
---
 src/win32/compat.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/win32/compat.c b/src/win32/compat.c
index 67df6fd..65ef791 100644
--- a/src/win32/compat.c
+++ b/src/win32/compat.c
@@ -410,7 +410,9 @@ inet_ntop6(const unsigned char *src, char *dst, int size)
     words[i / 2] = (src[i] << 8) | src[i + 1];
 
   best.base = -1;
+  best.len = 0;
   cur.base = -1;
+  cur.len = 0;
 
   for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) {
     if (words[i] == 0) {
-- 
1.7.7.6





More information about the Olsr-dev mailing list