mirror of
https://github.com/haproxy/haproxy.git
synced 2026-06-08 08:12:51 -04:00
BUILD/MEDIUM: http: remove calls to sprintf()
OpenBSD complains about this use of sprintf() : src/proto_http.o(.text+0xb0e6): In function `http_process_request': src/proto_http.c:4127: warning: sprintf() is often misused, please use snprintf() Here there's no risk as the strings are way shorter than the buffer size but let's fix it anyway.
This commit is contained in:
parent
a1dab55e1e
commit
e9187f8263
1 changed files with 3 additions and 3 deletions
|
|
@ -4053,7 +4053,7 @@ int http_process_request(struct session *s, struct channel *req, int an_bit)
|
|||
len = s->fe->fwdfor_hdr_len;
|
||||
memcpy(trash.str, s->fe->fwdfor_hdr_name, len);
|
||||
}
|
||||
len += sprintf(trash.str + len, ": %d.%d.%d.%d", pn[0], pn[1], pn[2], pn[3]);
|
||||
len += snprintf(trash.str + len, trash.size - len, ": %d.%d.%d.%d", pn[0], pn[1], pn[2], pn[3]);
|
||||
|
||||
if (unlikely(http_header_add_tail2(&txn->req, &txn->hdr_idx, trash.str, len) < 0))
|
||||
goto return_bad_req;
|
||||
|
|
@ -4081,7 +4081,7 @@ int http_process_request(struct session *s, struct channel *req, int an_bit)
|
|||
len = s->fe->fwdfor_hdr_len;
|
||||
memcpy(trash.str, s->fe->fwdfor_hdr_name, len);
|
||||
}
|
||||
len += sprintf(trash.str + len, ": %s", pn);
|
||||
len += snprintf(trash.str + len, trash.size - len, ": %s", pn);
|
||||
|
||||
if (unlikely(http_header_add_tail2(&txn->req, &txn->hdr_idx, trash.str, len) < 0))
|
||||
goto return_bad_req;
|
||||
|
|
@ -4124,7 +4124,7 @@ int http_process_request(struct session *s, struct channel *req, int an_bit)
|
|||
len = s->fe->orgto_hdr_len;
|
||||
memcpy(trash.str, s->fe->orgto_hdr_name, len);
|
||||
}
|
||||
len += sprintf(trash.str + len, ": %d.%d.%d.%d", pn[0], pn[1], pn[2], pn[3]);
|
||||
len += snprintf(trash.str + len, trash.size - len, ": %d.%d.%d.%d", pn[0], pn[1], pn[2], pn[3]);
|
||||
|
||||
if (unlikely(http_header_add_tail2(&txn->req, &txn->hdr_idx, trash.str, len) < 0))
|
||||
goto return_bad_req;
|
||||
|
|
|
|||
Loading…
Reference in a new issue