mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-04-12 18:40:23 +08:00
BR2979629: vsnprintf: Use nasm_malloc
There is no nasm_malloc_error helper anymore. Use nasm_error instead. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
parent
5d269789a5
commit
cdcd1f7ac4
@ -23,17 +23,15 @@ int vsnprintf(char *str, size_t size, const char *format, va_list ap)
|
||||
int rv, bytes;
|
||||
|
||||
if (size > BUFFER_SIZE) {
|
||||
nasm_malloc_error(ERR_PANIC|ERR_NOFILE,
|
||||
"snprintf: size (%d) > BUFFER_SIZE (%d)",
|
||||
size, BUFFER_SIZE);
|
||||
nasm_error(ERR_PANIC|ERR_NOFILE,
|
||||
"vsnprintf: size (%d) > BUFFER_SIZE (%d)",
|
||||
size, BUFFER_SIZE);
|
||||
size = BUFFER_SIZE;
|
||||
}
|
||||
|
||||
rv = vsprintf(snprintf_buffer, format, ap);
|
||||
if (rv >= BUFFER_SIZE) {
|
||||
nasm_malloc_error(ERR_PANIC|ERR_NOFILE,
|
||||
"snprintf buffer overflow");
|
||||
}
|
||||
if (rv >= BUFFER_SIZE)
|
||||
nasm_error(ERR_PANIC|ERR_NOFILE, "vsnprintf buffer overflow");
|
||||
|
||||
if (size > 0) {
|
||||
if ((size_t)rv < size-1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user