diff options
| author | spicyjpeg <thatspicyjpeg@gmail.com> | 2023-05-11 23:45:33 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-11 23:45:33 +0200 |
| commit | 4230715311892502452f326f3618e5ef4dc81972 (patch) | |
| tree | 7c1fd052c84aeccd3a70417708f039dbab791726 | |
| parent | 04d7728350cbd04dd86cd894e906c98673e3f9a7 (diff) | |
| parent | 1d1b64871eacf288229f973c2bbb003fb81d78fc (diff) | |
Merge pull request #71 from saxbophone/patch-1
Add C11 error checking to vsnprintf()
| -rw-r--r-- | libpsn00b/libc/vsprintf.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libpsn00b/libc/vsprintf.c b/libpsn00b/libc/vsprintf.c index 9ca4cc5..585d23d 100644 --- a/libpsn00b/libc/vsprintf.c +++ b/libpsn00b/libc/vsprintf.c @@ -391,6 +391,9 @@ int vsnprintf(char *string, unsigned int size, const char *fmt, va_list ap) int zero_flag_imp = 0; int pad_quantity = 0; int last; + + // C11: required to check these cases and return error if detected + if (string == NULL || fmt == NULL || size == 0) { return -1; } l = strlen(fmt); |
