mirror of
https://github.com/curl/curl.git
synced 2026-06-18 11:06:08 +03:00
servers: fix off-by-3 OOB write for large loghex() inputs
Spotted by GitHub Code Quality Closes #22031
This commit is contained in:
parent
46ba384b1b
commit
5687d211c4
1 changed files with 1 additions and 1 deletions
|
|
@ -42,7 +42,7 @@ void loghex(const unsigned char *buffer, ssize_t len)
|
|||
ssize_t width = 0;
|
||||
int left = sizeof(data);
|
||||
|
||||
for(i = 0; i < len && (left >= 0); i++) {
|
||||
for(i = 0; i < len && (left > 2); i++) {
|
||||
snprintf(optr, left, "%02x", ptr[i]);
|
||||
width += 2;
|
||||
optr += 2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue