diff options
author | Daniel Stenberg <daniel@haxx.se> | 2016-04-01 10:14:06 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2016-04-01 10:46:36 +0200 |
commit | 55452ebdff47f98bf3cc383f1dfc3623fcaefefd (patch) | |
tree | d17d3be8fd9482658f07ef6b4532da9502499cf0 /tests/libtest/lib1512.c | |
parent | 7218b52c49aeb1452d1fb94b394b3de2da938f17 (diff) | |
download | gnurl-55452ebdff47f98bf3cc383f1dfc3623fcaefefd.tar.gz gnurl-55452ebdff47f98bf3cc383f1dfc3623fcaefefd.tar.bz2 gnurl-55452ebdff47f98bf3cc383f1dfc3623fcaefefd.zip |
curl/mprintf.h: remove support for _MPRINTF_REPLACE
The define is not in our name space and is therefore not protected by
our API promises.
It was only really used by libcurl internals but was mostly erased from
there already in 8aabbf5 (March 2015). This is supposedly the final
death blow to that define from everywhere.
As a side-effect, making sure _MPRINTF_REPLACE is gone and not used, I
made the lib tests in tests/libtest/ use curl_printf.h for its redefine
magic and then subsequently the use of sprintf() got banned in the tests
as well (as it is in libcurl internals) and I then replaced them all
with snprintf().
In the unlikely event that any users is actually using this define and
gets sad by this change, it is very easily copied to the user's own
code.
Diffstat (limited to 'tests/libtest/lib1512.c')
-rw-r--r-- | tests/libtest/lib1512.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/libtest/lib1512.c b/tests/libtest/lib1512.c index 759898737..bf03e1a4f 100644 --- a/tests/libtest/lib1512.c +++ b/tests/libtest/lib1512.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 2013, Linus Nielsen Feltzing <linus@haxx.se> + * Copyright (C) 2013 - 2016, Linus Nielsen Feltzing <linus@haxx.se> * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -49,7 +49,7 @@ int test(char *URL) return TEST_ERR_MAJOR_BAD; } - sprintf(dnsentry, "server.example.curl:%s:%s", port, address); + snprintf(dnsentry, sizeof(dnsentry), "server.example.curl:%s:%s", port, address); printf("%s\n", dnsentry); slist = curl_slist_append(slist, dnsentry); @@ -58,8 +58,9 @@ int test(char *URL) /* get an easy handle */ easy_init(curl[i]); /* specify target */ - sprintf(target_url, "http://server.example.curl:%s/path/1512%04i", - port, i + 1); + snprintf(target_url, sizeof(target_url), + "http://server.example.curl:%s/path/1512%04i", + port, i + 1); target_url[sizeof(target_url) - 1] = '\0'; easy_setopt(curl[i], CURLOPT_URL, target_url); /* go verbose */ |