aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/Include/alMain.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2007-12-22 14:00:10 -0800
committerChris Robinson <[email protected]>2007-12-22 14:00:10 -0800
commite516b3c0d317f2cceb5de6690705bfc6ff69f615 (patch)
treeb4b7046b38d72b50be28150c46318bdffe37515d /OpenAL32/Include/alMain.h
parent51c5fa94aa9592d2c25209b94b6cbe4349850cbd (diff)
Prevent possible buffer overflow in AL_PRINT
Diffstat (limited to 'OpenAL32/Include/alMain.h')
-rw-r--r--OpenAL32/Include/alMain.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 71e29e47..1f62b535 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -82,7 +82,9 @@ extern char _alDebug[256];
if(!_al_print_fn) _al_print_fn = __FILE__; \
else _al_print_fn += 1; \
_al_print_i = snprintf(_alDebug, sizeof(_alDebug), "AL lib: %s:%d: ", _al_print_fn, __LINE__); \
- snprintf(_alDebug+_al_print_i, sizeof(_alDebug)-_al_print_i, __VA_ARGS__); \
+ if(_al_print_i < (int)sizeof(_alDebug) && _al_print_i > 0) \
+ snprintf(_alDebug+_al_print_i, sizeof(_alDebug)-_al_print_i, __VA_ARGS__); \
+ _alDebug[sizeof(_alDebug)-1] = 0; \
fprintf(stderr, "%s", _alDebug); \
} while(0)