diff options
author | Daniel Stenberg <daniel@haxx.se> | 2016-04-03 10:46:36 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2016-04-03 10:47:13 +0200 |
commit | d4d87d7eada1b69674ece975f14db942c6de1cae (patch) | |
tree | fcd4599e8bcc26a21b577a5b2c512b017109e6df /tests | |
parent | 0326b06770d6a3bd8c877497ef949ff4cdf30210 (diff) |
unit1604: fix snprintf
follow-up to 0326b06
sizeof(pointer) is no good for the buffer size!
Reported-by: Viktor Szakats
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/unit1604.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/unit/unit1604.c b/tests/unit/unit1604.c index 3fb9636ee..242be0005 100644 --- a/tests/unit/unit1604.c +++ b/tests/unit/unit1604.c @@ -45,7 +45,7 @@ static void unit_stop(void) static char *getflagstr(int flags) { char *buf = malloc(256); fail_unless(buf, "out of memory"); - snprintf(buf, sizeof(buf), "%s,%s,%s,%s", + snprintf(buf, 256, "%s,%s,%s,%s", ((flags & SANITIZE_ALLOW_COLONS) ? "SANITIZE_ALLOW_COLONS" : ""), ((flags & SANITIZE_ALLOW_PATH) ? "SANITIZE_ALLOW_PATH" : ""), ((flags & SANITIZE_ALLOW_RESERVED) ? "SANITIZE_ALLOW_RESERVED" : ""), @@ -56,7 +56,7 @@ static char *getflagstr(int flags) { static char *getcurlcodestr(int cc) { char *buf = malloc(256); fail_unless(buf, "out of memory"); - snprintf(buf, sizeof(buf), "%s (%d)", + snprintf(buf, 256, "%s (%d)", (cc == SANITIZE_ERR_OK ? "SANITIZE_ERR_OK" : cc == SANITIZE_ERR_BAD_ARGUMENT ? "SANITIZE_ERR_BAD_ARGUMENT" : cc == SANITIZE_ERR_INVALID_PATH ? "SANITIZE_ERR_INVALID_PATH" : |