Code

unixsock_test: Fix a potential uninitialized memory access in mock_write.
authorSebastian Harl <sh@tokkee.org>
Wed, 17 Aug 2016 21:16:47 +0000 (23:16 +0200)
committerSebastian Harl <sh@tokkee.org>
Wed, 17 Aug 2016 21:16:47 +0000 (23:16 +0200)
t/unit/utils/unixsock_test.c

index 321a96e..6ddb6d4 100644 (file)
@@ -104,7 +104,7 @@ mock_write(void *cookie, const char *buf, size_t size)
 
        if (last_write)
                free(last_write);
-       last_write = strdup(buf);
+       last_write = strndup(buf, size);
        ++c->pos;
        return (ssize_t)size;
 } /* mock_write */