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 321a96e7d5d7fd389dc9afa51339ec51718d0132..6ddb6d453abf739fec49a51e13953d213b2d1e1e 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 */