device: Fix memory corruption, do not call log10(0)
This commit is contained in:
1 parent
87202c38a0
commit
3e863759d3
1 file changed
+1
-1
+1
-1
@@ -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 )
|
||||
|
||||
Reference in new issue
Block a user