diff --git a/winpr/libwinpr/utils/execinfo/debug.c b/winpr/libwinpr/utils/execinfo/debug.c index 9867b9d34..453278439 100644 --- a/winpr/libwinpr/utils/execinfo/debug.c +++ b/winpr/libwinpr/utils/execinfo/debug.c @@ -18,6 +18,7 @@ * limitations under the License. */ +#include #include #include @@ -57,7 +58,8 @@ void* winpr_execinfo_backtrace(DWORD size) return NULL; } - const int rc = backtrace(data->buffer, size); + assert(size <= INT32_MAX); + const int rc = backtrace(data->buffer, (int)size); if (rc < 0) { free(data); @@ -80,7 +82,8 @@ char** winpr_execinfo_backtrace_symbols(void* buffer, size_t* used) if (used) *used = data->used; - return backtrace_symbols(data->buffer, data->used); + assert(data->used < INT32_MAX); + return backtrace_symbols(data->buffer, (int)data->used); } void winpr_execinfo_backtrace_symbols_fd(void* buffer, int fd) @@ -90,5 +93,6 @@ void winpr_execinfo_backtrace_symbols_fd(void* buffer, int fd) if (!data) return; - backtrace_symbols_fd(data->buffer, data->used, fd); + assert(data->used <= INT32_MAX); + backtrace_symbols_fd(data->buffer, (int)data->used, fd); }