← Commit list

8932063828

Viktor Szakats
Viktor Szakats
2026-06-15
SUCCESS Duration: 253s

Subject

lib668: do not assume null-terminator in test input data

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 →

tests/libtest/lib668.c+5 -4
@@ -25,13 +25,13 @@
struct t668_WriteThis {
const char *readptr;
- curl_off_t sizeleft;
+ size_t sizeleft;
};
static size_t t668_read_cb(char *ptr, size_t size, size_t nmemb, void *userp)
{
struct t668_WriteThis *pooh = (struct t668_WriteThis *)userp;
- size_t len = strlen(pooh->readptr);
+ size_t len = pooh->sizeleft;
(void)size; /* Always 1 */
@@ -40,6 +40,7 @@ static size_t t668_read_cb(char *ptr, size_t size, size_t nmemb, void *userp)
if(len) {
memcpy(ptr, pooh->readptr, len);
pooh->readptr += len;
+ pooh->sizeleft -= len;
}
return len;
}
@@ -76,7 +77,7 @@ static CURLcode test_lib668(const char *URL)
/* Prepare the callback structures. */
pooh1.readptr = testdata;
- pooh1.sizeleft = (curl_off_t)(sizeof(testdata) - 1);
+ pooh1.sizeleft = sizeof(testdata) - 1;
pooh2 = pooh1;
/* Build the mime tree. */
@@ -84,7 +85,7 @@ static CURLcode test_lib668(const char *URL)
part = curl_mime_addpart(mime);
curl_mime_name(part, "field1");
/* Early end of data detection can be done because the data size is known. */
- curl_mime_data_cb(part, (curl_off_t)(sizeof(testdata) - 1),
+ curl_mime_data_cb(part, (curl_off_t)pooh1.sizeleft,
t668_read_cb, NULL, NULL, &pooh1);
part = curl_mime_addpart(mime);
curl_mime_name(part, "field2");