diff options
author | Daniel Stenberg <daniel@haxx.se> | 2022-12-05 10:08:53 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2022-12-06 08:57:04 +0100 |
commit | f3fc089debe9eda1602c0684ffdc1bab84f36f6d (patch) | |
tree | 28e299565d3a93ec98f915a7f0f7c2c1f867f2e6 | |
parent | c6f602c93ff33bc7cb6091852a3b0e80d2443e1c (diff) | |
download | curl-f3fc089debe9eda1602c0684ffdc1bab84f36f6d.tar.gz |
unit1302: slightly extended
To test more base64 decoding
-rw-r--r-- | tests/unit/unit1302.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/unit/unit1302.c b/tests/unit/unit1302.c index afc571662..a9f37b53f 100644 --- a/tests/unit/unit1302.c +++ b/tests/unit/unit1302.c @@ -169,6 +169,15 @@ fail_unless(rc == CURLE_BAD_CONTENT_ENCODING, fail_unless(size == 0, "size should be 0"); fail_if(decoded, "returned pointer should be NULL"); +/* This is also illegal input as it contains a padding character mid input */ +size = 1; /* not zero */ +decoded = &anychar; /* not NULL */ +rc = Curl_base64_decode("aWlpa=Q=", &decoded, &size); +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"); + /* This is garbage input as it contains an illegal base64 character */ size = 1; /* not zero */ decoded = &anychar; /* not NULL */ @@ -178,4 +187,5 @@ fail_unless(rc == CURLE_BAD_CONTENT_ENCODING, fail_unless(size == 0, "size should be 0"); fail_if(decoded, "returned pointer should be NULL"); + UNITTEST_STOP |