From 3e863759d3e37194884b0b27d9e005855768acb6 Mon Sep 17 00:00:00 2001 From: Pali Rohár Date: Sat, 24 Nov 2012 12:38:56 +0100 Subject: device: Fix memory corruption, do not call log10(0) --- src/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/device.c b/src/device.c index 78c3a7b..7f2a84d 100644 --- a/src/device.c +++ b/src/device.c @@ -143,7 +143,7 @@ char * hwrevs_alloc_to_string(const int16_t * hwrevs) { int len = 0; for ( i = 0; hwrevs[i] != -1; ++i ) - len += log10(hwrevs[i])+2; + len += log10(hwrevs[i]+1)+2; ret = calloc(1, len+1); if ( ! ret ) -- cgit v1.2.3