diff options
author | Daniel Stenberg <daniel@haxx.se> | 2007-09-30 22:40:24 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2007-09-30 22:40:24 +0000 |
commit | ec08e2f9f24da5974be1ab222c5703fd9fb3722f (patch) | |
tree | efe5f2f8496623b8bdce46f3d4103a246de2aaba /tests/libtest | |
parent | 38dd0ede9ddcf7491792e7edd98665841667ae67 (diff) |
Alex Fishman reported a curl_easy_escape() problem that was made the
function do wrong on all input bytes that are >= 0x80 (decimal 128) due to a
signed / unsigned mistake in the code. I fixed it and added test case 543 to
verify.
Diffstat (limited to 'tests/libtest')
-rw-r--r-- | tests/libtest/Makefile.am | 4 | ||||
-rw-r--r-- | tests/libtest/lib543.c | 32 |
2 files changed, 35 insertions, 1 deletions
diff --git a/tests/libtest/Makefile.am b/tests/libtest/Makefile.am index 395564a6e..f0fb24ed0 100644 --- a/tests/libtest/Makefile.am +++ b/tests/libtest/Makefile.am @@ -47,7 +47,7 @@ SUPPORTFILES = first.c test.h noinst_PROGRAMS = lib500 lib501 lib502 lib503 lib504 lib505 lib506 \ lib507 lib508 lib509 lib510 lib511 lib512 lib513 lib514 lib515 lib516 \ lib517 lib518 lib519 lib520 lib521 lib523 lib524 lib525 lib526 lib527 \ - lib529 lib530 lib532 lib533 lib536 lib537 lib540 lib541 lib542 + lib529 lib530 lib532 lib533 lib536 lib537 lib540 lib541 lib542 lib543 # Dependencies (may need to be overriden) LDADD = $(LIBDIR)/libcurl.la @@ -130,3 +130,5 @@ lib540_SOURCES = lib540.c $(SUPPORTFILES) lib541_SOURCES = lib541.c $(SUPPORTFILES) lib542_SOURCES = lib542.c $(SUPPORTFILES) + +lib543_SOURCES = lib543.c $(SUPPORTFILES) diff --git a/tests/libtest/lib543.c b/tests/libtest/lib543.c new file mode 100644 index 000000000..2e930d2d6 --- /dev/null +++ b/tests/libtest/lib543.c @@ -0,0 +1,32 @@ +/***************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * $Id$ + * + * Based on Alex Fishman's bug report on September 30, 2007 + */ + +#include "setup.h" +#include "test.h" + +int test(char *URL) +{ + unsigned char a[] = {0x9c, 0x26, 0x4b, 0x3d, 0x49, 0x4, 0xa1, 0x1, + 0xe0, 0xd8, 0x7c, 0x20, 0xb7, 0xef, 0x53, 0x29, 0xfa, + 0x1d, 0x57, 0xe1}; + + CURL* easy = curl_easy_init(); + char* s = curl_easy_escape(easy, (char*)a, sizeof(a)); + (void)URL; + + printf("%s\n", s); + + curl_free(s); + curl_easy_cleanup(easy); + + return 0; +} |