Replaced all uses of sprintf() with the safer snprintf(). It is just a

precaution to prevent mistakes to lead to buffer overflows.
This commit is contained in:
Daniel Stenberg 2004-06-24 11:54:11 +00:00
parent 5e34f3dc01
commit feb2dd2835
13 changed files with 490 additions and 486 deletions

View file

@ -300,13 +300,14 @@ CURLcode Curl_file(struct connectdata *conn)
date. */
if(conn->bits.no_body && data->set.include_header && fstated) {
CURLcode result;
sprintf(buf, "Content-Length: %" FORMAT_OFF_T "\r\n", expected_size);
snprintf(buf, sizeof(data->state.buffer),
"Content-Length: %" FORMAT_OFF_T "\r\n", expected_size);
result = Curl_client_write(data, CLIENTWRITE_BOTH, buf, 0);
if(result)
return result;
sprintf(buf, "Accept-ranges: bytes\r\n");
result = Curl_client_write(data, CLIENTWRITE_BOTH, buf, 0);
result = Curl_client_write(data, CLIENTWRITE_BOTH,
"Accept-ranges: bytes\r\n", 0);
if(result)
return result;