mirror of
https://repo.or.cz/socat.git
synced 2025-07-03 20:16:32 +00:00
The internal vsnprintf_r function looped or crashed on size parameter with hexadecimal output
This commit is contained in:
parent
0fdd9ceb58
commit
53f528335c
2 changed files with 5 additions and 2 deletions
|
@ -296,7 +296,7 @@ static char *diag_longlong_to_dec(char *field, size_t n, long long ll, int leadi
|
|||
*/
|
||||
static char *diag_ulonglong_to_hex(char *field, size_t n, unsigned long long ull, int leading0, size_t size) {
|
||||
char *np = field+n; /* point to the end */
|
||||
unsigned int i;
|
||||
ptrdiff_t i;
|
||||
char c;
|
||||
|
||||
if (n == 0) return NULL;
|
||||
|
@ -313,7 +313,7 @@ static char *diag_ulonglong_to_hex(char *field, size_t n, unsigned long long ull
|
|||
c = ' ';
|
||||
}
|
||||
i = size - strlen(np);
|
||||
while (--i >= 0) {
|
||||
while (i-- > 0) {
|
||||
*--np = c;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue