diff options
| author | Andreas Schneider <asn@samba.org> | 2014-04-14 21:54:17 +0200 |
|---|---|---|
| committer | Andreas Schneider <asn@samba.org> | 2014-04-25 14:27:05 +0200 |
| commit | 1d7993bd4076bf4b15807fcf340976123817bd0b (patch) | |
| tree | b4e44e3e34ffb9ea6d9f280a11b5a5591886e9ef | |
| parent | 7f1039532d24908963a8f104b2c9c4d39998b701 (diff) | |
| download | socket_wrapper-1d7993bd4076bf4b15807fcf340976123817bd0b.tar.gz socket_wrapper-1d7993bd4076bf4b15807fcf340976123817bd0b.tar.xz socket_wrapper-1d7993bd4076bf4b15807fcf340976123817bd0b.zip | |
tests: Fix use of tainted string in test_ioctl.
CID: #17221
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
| -rw-r--r-- | tests/test_ioctl.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/test_ioctl.c b/tests/test_ioctl.c index 077e553..1f31c2e 100644 --- a/tests/test_ioctl.c +++ b/tests/test_ioctl.c @@ -33,6 +33,7 @@ static void teardown(void **state) { char remove_cmd[256] = {0}; const char *swrap_dir = getenv("SOCKET_WRAPPER_DIR"); + char *s; int rc; (void) state; /* unused */ @@ -40,7 +41,11 @@ static void teardown(void **state) if (swrap_dir == NULL) { return; } - snprintf(remove_cmd, sizeof(remove_cmd), "rm -rf %s", swrap_dir); + + /* Do not use a tainted string in snprintf */ + s = strdup(swrap_dir); + snprintf(remove_cmd, sizeof(remove_cmd), "rm -rf %s", s); + free(s); rc = system(remove_cmd); if (rc < 0) { |
