summaryrefslogtreecommitdiff
path: root/lib/inet_ntop.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-06-24 11:54:11 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-06-24 11:54:11 +0000
commitfeb2dd283533f842c9b6e4cc2fcc7fd35638d5a0 (patch)
treef0ecc2bd74917e67e3e9853e04a6ca16c2770eb3 /lib/inet_ntop.c
parent5e34f3dc0133333fb398dd4b285a63f58aa441da (diff)
downloadcurl-feb2dd283533f842c9b6e4cc2fcc7fd35638d5a0.tar.gz
Replaced all uses of sprintf() with the safer snprintf(). It is just a
precaution to prevent mistakes to lead to buffer overflows.
Diffstat (limited to 'lib/inet_ntop.c')
-rw-r--r--lib/inet_ntop.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/inet_ntop.c b/lib/inet_ntop.c
index 9dfccb3c6..eec06073b 100644
--- a/lib/inet_ntop.c
+++ b/lib/inet_ntop.c
@@ -24,6 +24,9 @@
#include <string.h>
#include <errno.h>
+#define _MPRINTF_REPLACE /* use our functions only */
+#include <curl/mprintf.h>
+
#include "inet_ntop.h"
#if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
@@ -152,7 +155,7 @@ static const char *inet_ntop6 (const u_char *src, char *dst, size_t size)
tp += strlen(tp);
break;
}
- tp += sprintf (tp, "%lx", words[i]);
+ tp += snprintf(tp, 4, "%lx", words[i]);
}
/* Was it a trailing run of 0x00's?