diff options
author | Marco Paland <marco@paland.com> | 2018-05-13 02:05:40 +0200 |
---|---|---|
committer | Marco Paland <marco@paland.com> | 2018-05-13 02:05:40 +0200 |
commit | d12e52be4c207bb3b8a35f512b2cddf8deb3ceaf (patch) | |
tree | 0592f0bb0ad263e22eb4672fb097772ad6d80e5b /printf.c | |
parent | a6e81f9c598e722571b9ae115fda6ef770a57e66 (diff) | |
download | printf-d12e52be4c207bb3b8a35f512b2cddf8deb3ceaf.tar.gz printf-d12e52be4c207bb3b8a35f512b2cddf8deb3ceaf.tar.bz2 printf-d12e52be4c207bb3b8a35f512b2cddf8deb3ceaf.zip |
fix(printf): pass dummy buffer for printf to _vsnprintf instead of NULL
Fixes #15
Diffstat (limited to 'printf.c')
-rw-r--r-- | printf.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -647,7 +647,8 @@ int printf(const char* format, ...) {
va_list va;
va_start(va, format);
- const int ret = _vsnprintf(_out_char, NULL, (size_t)-1, format, va);
+ char buffer[1];
+ const int ret = _vsnprintf(_out_char, buffer, (size_t)-1, format, va);
va_end(va);
return ret;
}
|