mirror of
https://github.com/curl/curl.git
synced 2026-04-14 13:01:42 +08:00
lib547, 555: fix off-by-one null-terminator in read callback
`strcpy()` wrote an unnecessary null-terminator past the available read buffer. test551 was also affected because it reuses lib547. Cherry-picked from #20076 Closes #20082
This commit is contained in:
parent
7e064d0756
commit
66aec526fc
@ -44,7 +44,7 @@ static size_t t547_read_cb(char *ptr, size_t size, size_t nmemb, void *clientp)
|
||||
|
||||
if(size * nmemb >= T547_DATALEN) {
|
||||
curl_mfprintf(stderr, "READ!\n");
|
||||
strcpy(ptr, t547_uploadthis);
|
||||
memcpy(ptr, t547_uploadthis, T547_DATALEN);
|
||||
return T547_DATALEN;
|
||||
}
|
||||
curl_mfprintf(stderr, "READ NOT FINE!\n");
|
||||
|
||||
@ -48,7 +48,7 @@ static size_t t555_read_cb(char *ptr, size_t size, size_t nmemb, void *clientp)
|
||||
|
||||
if(size * nmemb >= T555_DATALEN) {
|
||||
curl_mfprintf(stderr, "READ!\n");
|
||||
strcpy(ptr, t555_uploadthis);
|
||||
memcpy(ptr, t555_uploadthis, T555_DATALEN);
|
||||
return T555_DATALEN;
|
||||
}
|
||||
curl_mfprintf(stderr, "READ NOT FINE!\n");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user