diff options
author | Doug Horn <doughorn@google.com> | 2016-08-09 14:19:08 -0700 |
---|---|---|
committer | Doug Horn <doughorn@google.com> | 2016-08-09 14:19:08 -0700 |
commit | d2a1f6e3e29da71414580d66d400f4c1453eaefd (patch) | |
tree | 1504f6dcd5135f7200ae364a1b2e2d4d5d65f783 | |
parent | 9158cf3193f54b60d85e77ddbb526af4b6860145 (diff) | |
download | netifaces-d2a1f6e3e29da71414580d66d400f4c1453eaefd.tar.gz |
Fix stack overwriting when len=0.
-rw-r--r-- | netifaces.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/netifaces.c b/netifaces.c index 8b82819..6268fd7 100644 --- a/netifaces.c +++ b/netifaces.c @@ -397,7 +397,8 @@ string_from_sockaddr (struct sockaddr *addr, sprintf (ptr, "%02x:", data[n] & 0xff); ptr += 3; } - *--ptr = '\0'; + if (len) + *--ptr = '\0'; } if (!buffer[0]) |