← Commit list

5e2d4d7905

Daniel Stenberg
Daniel Stenberg
2025-09-19
FAILED Duration: 153s

Subject

base64: accept zero length argument to base64_encode

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/curlx/base64.c+1 -3
@@ -182,7 +182,7 @@ static CURLcode base64_encode(const char *table64,
*outlen = 0;
if(!insize)
- insize = strlen(inputbuff);
+ return CURLE_OK;
#if SIZEOF_SIZE_T == 4
if(insize > UINT_MAX/4)
@@ -240,8 +240,6 @@ static CURLcode base64_encode(const char *table64,
* encoded data. Size of encoded data is returned in variable pointed by
* outlen.
*
- * Input length of 0 indicates input buffer holds a null-terminated string.
- *
* Returns CURLE_OK on success, otherwise specific error code. Function
* output shall not be considered valid unless CURLE_OK is returned.
*
tests/unit/unit1302.c+1 -1
@@ -172,7 +172,7 @@ static CURLcode test_unit1302(const char *arg)
fprintf(stderr, "Test %u URL encoded output length %d instead of %d\n",
i, (int)olen, (int)e->olen);
}
- if(memcmp(out, e->output, e->olen)) {
+ if(out && memcmp(out, e->output, e->olen)) {
fprintf(stderr, "Test %u URL encoded badly. Got '%s', expected '%s'\n",
i, out, e->output);
unitfail++;