device: Fix memory corruption, do not call log10(0)

This commit is contained in:
Pali Rohár committed 2012-11-24 12:38:56 +01:00
1 parent 87202c38a0
commit 3e863759d3
1 file changed
+1 -1
+1 -1
View File
@@ -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 )