Browse Source

Unsafe function usage

High Risk to  use vsprintf(). It must be replaced by vsnprintf.
pull/789/head
Eibz-Chan GitHub 3 years ago
parent
commit
c8b7e11441
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      vasprintf_compat.h

+ 1
- 1
vasprintf_compat.h View File

@@ -51,7 +51,7 @@ static int vasprintf(char **buf, const char *fmt, va_list ap)
return -1;
}

if ((chars = vsprintf(b, fmt, ap)) < 0)
if ((chars = vsnprintf(b, ((size_t)chars + 1), fmt, ap)) < 0)
{
free(b);
}


Loading…
Cancel
Save