-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test1605: verify negative input lengths to (un)escape functions
- Loading branch information
Showing
4 changed files
with
78 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<testcase> | ||
<info> | ||
<keywords> | ||
unittest | ||
</keywords> | ||
</info> | ||
|
||
# | ||
# Client-side | ||
<client> | ||
<server> | ||
none | ||
</server> | ||
<features> | ||
unittest | ||
</features> | ||
<name> | ||
Test negative data lengths as input to libcurl functions | ||
</name> | ||
<tool> | ||
unit1605 | ||
</tool> | ||
</client> | ||
|
||
</testcase> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/*************************************************************************** | ||
* _ _ ____ _ | ||
* Project ___| | | | _ \| | | ||
* / __| | | | |_) | | | ||
* | (__| |_| | _ <| |___ | ||
* \___|\___/|_| \_\_____| | ||
* | ||
* Copyright (C) 1998 - 2016, 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 | ||
* are also available at https://curl.haxx.se/docs/copyright.html. | ||
* | ||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell | ||
* copies of the Software, and permit persons to whom the Software is | ||
* furnished to do so, under the terms of the COPYING file. | ||
* | ||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
* KIND, either express or implied. | ||
* | ||
***************************************************************************/ | ||
#include "curlcheck.h" | ||
|
||
#include "llist.h" | ||
|
||
static CURLcode unit_setup(void) | ||
{ | ||
return CURLE_OK; | ||
} | ||
|
||
static void unit_stop(void) | ||
{ | ||
|
||
} | ||
|
||
UNITTEST_START | ||
CURL *easy = curl_easy_init(); | ||
int len; | ||
char *esc; | ||
|
||
esc = curl_easy_escape(easy, "", -1); | ||
fail_unless(esc == NULL, "negative string length can't work"); | ||
|
||
esc = curl_easy_unescape(easy, "%41%41%41%41", -1, &len); | ||
fail_unless(esc == NULL, "negative string length can't work"); | ||
|
||
curl_easy_cleanup(easy); | ||
|
||
UNITTEST_STOP |