summaryrefslogtreecommitdiff
path: root/src/tool_setopt.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2013-03-06 13:27:51 +0100
committerDaniel Stenberg <daniel@haxx.se>2013-03-07 11:08:05 +0100
commit7f963a19ecbceef5d7e95e677ccc089d04ef987f (patch)
tree459db8c1b5d5243e9b5e3ebfd3e8974131d321de /src/tool_setopt.c
parent9ceee69ff7d6139de759a4f25051e0d661e0c2b0 (diff)
downloadcurl-7f963a19ecbceef5d7e95e677ccc089d04ef987f.tar.gz
checksrc: ban unsafe functions
The list of unsafe functions currently consists of sprintf, vsprintf, strcat, strncat and gets. Subsequently, some existing code needed updating to avoid warnings on this.
Diffstat (limited to 'src/tool_setopt.c')
-rw-r--r--src/tool_setopt.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/tool_setopt.c b/src/tool_setopt.c
index 4014177f2..4493e5f8d 100644
--- a/src/tool_setopt.c
+++ b/src/tool_setopt.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2013, 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
@@ -199,7 +199,7 @@ static char *c_escape(const char *str)
e += 2;
}
else if(! isprint(c)) {
- sprintf(e, "\\%03o", c);
+ snprintf(e, 4, "\\%03o", c);
e += 4;
}
else
@@ -270,7 +270,7 @@ CURLcode tool_setopt_flags(CURL *curl, struct Configurable *config,
if(!rest)
break; /* handled them all */
/* replace with all spaces for continuation line */
- sprintf(preamble, "%*s", strlen(preamble), "");
+ snprintf(preamble, sizeof(preamble), "%*s", strlen(preamble), "");
}
}
/* If any bits have no definition, output an explicit value.
@@ -313,7 +313,7 @@ CURLcode tool_setopt_bitmask(CURL *curl, struct Configurable *config,
if(!rest)
break; /* handled them all */
/* replace with all spaces for continuation line */
- sprintf(preamble, "%*s", strlen(preamble), "");
+ snprintf(preamble, sizeof(preamble), "%*s", strlen(preamble), "");
}
}
/* If any bits have no definition, output an explicit value.