]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Don't assume snprintf() returns the number of characters formatted.
authorGuy Harris <[email protected]>
Sun, 2 Feb 2014 23:02:33 +0000 (15:02 -0800)
committerGuy Harris <[email protected]>
Sun, 2 Feb 2014 23:02:33 +0000 (15:02 -0800)
On some UN*Xes (such as some versions of HP-UX), it doesn't.

print-icmp6.c

index eaa48b03a1ebd74f025cfa7a6f49e54b1dc891b2..ef5128c947d1c0accf7c47ad191fbc11ae762cac 100644 (file)
@@ -660,8 +660,8 @@ rpl_format_dagid(char dagid_str[65], const u_char *dagid)
                 if(isprint(dagid[i])) {
                         *d++ = dagid[i];
                 } else {
-                        int cnt=snprintf(d,4,"0x%02x", dagid[i]);
-                        d += cnt;
+                        snprintf(d,4,"0x%02x", dagid[i]);
+                        d += 4;
                 }
         }
         *d++ = '\0';