summaryrefslogtreecommitdiff
path: root/tests/server/sockfilt.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2018-11-22 09:01:24 +0100
committerDaniel Stenberg <daniel@haxx.se>2018-11-23 08:26:51 +0100
commitdcd6f810255785d52b89150e18460fb0899d4f7e (patch)
treec3cb7cdcb79dbf752edcd997934e44a2e9998397 /tests/server/sockfilt.c
parent9944d6ba334f07b0b6199bdb5bb82091c88c16ed (diff)
downloadcurl-dcd6f810255785d52b89150e18460fb0899d4f7e.tar.gz
snprintf: renamed and we now only use msnprintf()
The function does not return the same value as snprintf() normally does, so readers may be mislead into thinking the code works differently than it actually does. A different function name makes this easier to detect. Reported-by: Tomas Hoger Assisted-by: Daniel Gustafsson Fixes #3296 Closes #3297
Diffstat (limited to 'tests/server/sockfilt.c')
-rw-r--r--tests/server/sockfilt.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c
index 86a1ff52d..569be6f6c 100644
--- a/tests/server/sockfilt.c
+++ b/tests/server/sockfilt.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -486,20 +486,20 @@ static void lograw(unsigned char *buffer, ssize_t len)
for(i = 0; i<len; i++) {
switch(ptr[i]) {
case '\n':
- snprintf(optr, left, "\\n");
+ msnprintf(optr, left, "\\n");
width += 2;
optr += 2;
left -= 2;
break;
case '\r':
- snprintf(optr, left, "\\r");
+ msnprintf(optr, left, "\\r");
width += 2;
optr += 2;
left -= 2;
break;
default:
- snprintf(optr, left, "%c", (ISGRAPH(ptr[i]) ||
- ptr[i] == 0x20) ?ptr[i]:'.');
+ msnprintf(optr, left, "%c", (ISGRAPH(ptr[i]) ||
+ ptr[i] == 0x20) ?ptr[i]:'.');
width++;
optr++;
left--;
@@ -1062,9 +1062,9 @@ static bool juggle(curl_socket_t *sockfdp,
else if(!memcmp("PORT", buffer, 4)) {
/* Question asking us what PORT number we are listening to.
Replies to PORT with "IPv[num]/[port]" */
- snprintf((char *)buffer, sizeof(buffer), "%s/%hu\n", ipv_inuse, port);
+ msnprintf((char *)buffer, sizeof(buffer), "%s/%hu\n", ipv_inuse, port);
buffer_len = (ssize_t)strlen((char *)buffer);
- snprintf(data, sizeof(data), "PORT\n%04zx\n", buffer_len);
+ msnprintf(data, sizeof(data), "PORT\n%04zx\n", buffer_len);
if(!write_stdout(data, 10))
return FALSE;
if(!write_stdout(buffer, buffer_len))
@@ -1155,7 +1155,7 @@ static bool juggle(curl_socket_t *sockfdp,
nread_socket = sread(sockfd, buffer, sizeof(buffer));
if(nread_socket > 0) {
- snprintf(data, sizeof(data), "DATA\n%04zx\n", nread_socket);
+ msnprintf(data, sizeof(data), "DATA\n%04zx\n", nread_socket);
if(!write_stdout(data, 10))
return FALSE;
if(!write_stdout(buffer, nread_socket))