diff options
author | Daniel Stenberg <daniel@haxx.se> | 2007-01-25 20:47:47 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2007-01-25 20:47:47 +0000 |
commit | 1c0224be4296da63d1c84809f7ef4e32ceac27f4 (patch) | |
tree | 986705358a6d91f1aca64b3e49c5f3097b076cef /src | |
parent | dbdb7fa55abd6a9206fd484d813cada36d9dfc08 (diff) |
ugha, prevent a buffer overflow and allow very long strings in the generated
libcurl source...
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/main.c b/src/main.c index bee010c03..ab5bbc595 100644 --- a/src/main.c +++ b/src/main.c @@ -3212,7 +3212,7 @@ CURLcode _my_setopt(CURL *curl, const char *name, CURLoption tag, ...) { va_list arg; CURLcode ret; - char buffer[128]; + char *bufp; char value[256]; bool remark=FALSE; @@ -3249,13 +3249,12 @@ CURLcode _my_setopt(CURL *curl, const char *name, CURLoption tag, ...) ret = curl_easy_setopt(curl, tag, oval); } - sprintf(buffer, "%scurl_easy_setopt(hnd, %s, %s);%s", - remark?"/* ":"", - name, value, - remark?" [REMARK] */":""); - - easycode = curl_slist_append(easycode, buffer); + bufp = curl_maprintf("%scurl_easy_setopt(hnd, %s, %s);%s", + remark?"/* ":"", name, value, + remark?" [REMARK] */":""); + easycode = curl_slist_append(easycode, bufp); + curl_free(bufp); va_end(arg); return ret; |