diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/unit1302.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/tests/unit/unit1302.c b/tests/unit/unit1302.c index b5688f047..6886af8c4 100644 --- a/tests/unit/unit1302.c +++ b/tests/unit/unit1302.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, 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 @@ -31,7 +31,7 @@ static struct SessionHandle *data; static CURLcode unit_setup( void ) { data = curl_easy_init(); - if (!data) + if(!data) return CURLE_OUT_OF_MEMORY; return CURLE_OK; } @@ -128,13 +128,12 @@ fail_unless(rc == CURLE_BAD_CONTENT_ENCODING, "return code should be CURLE_BAD_C fail_unless(size == 0, "size should be 0"); fail_if(decoded, "returned pointer should be NULL"); -/* this is garbage input that libcurl decodes as far as possible */ -size = 0; -decoded = NULL; +/* This is garbage input as it contains an illegal base64 character */ +size = 1; /* not zero */ +decoded = &anychar; /* not NULL */ rc = Curl_base64_decode("a\x1f==", &decoded, &size); -fail_unless(rc == CURLE_OK, "return code should be CURLE_OK"); -fail_unless(size == 1, "size should be 1"); -fail_if(!decoded, "returned pointer should not be NULL"); -Curl_safefree(decoded); +fail_unless(rc == CURLE_BAD_CONTENT_ENCODING, "return code should be CURLE_BAD_CONTENT_ENCODING"); +fail_unless(size == 0, "size should be 0"); +fail_if(decoded, "returned pointer should be NULL"); UNITTEST_STOP |