From: Sebastian Harl Date: Wed, 17 Aug 2016 21:16:47 +0000 (+0200) Subject: unixsock_test: Fix a potential uninitialized memory access in mock_write. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=41730b69312c672a73f8991fec4f83a1b1d11d30;p=sysdb.git unixsock_test: Fix a potential uninitialized memory access in mock_write. --- diff --git a/t/unit/utils/unixsock_test.c b/t/unit/utils/unixsock_test.c index 321a96e..6ddb6d4 100644 --- a/t/unit/utils/unixsock_test.c +++ b/t/unit/utils/unixsock_test.c @@ -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 */