]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
compat: fix strndup
authorVincent Bernat <bernat@luffy.cx>
Sun, 23 Jun 2013 08:03:27 +0000 (10:03 +0200)
committerVincent Bernat <bernat@luffy.cx>
Sun, 23 Jun 2013 08:03:27 +0000 (10:03 +0200)
src/compat/strndup.c

index f0f1f3e89a7ad7625e9634aacaafcd44afcc9b4b..9b57d4b7935e77f4996cd6d3045ecf4cb3593256 100644 (file)
@@ -18,5 +18,6 @@ strndup(const char *string, size_t maxlen)
        if (!result) return 0;
 
        memcpy(result, string, len);
+       result[len] = '\0';
        return result;
 }