From: Bert Vermeulen Date: Thu, 20 Nov 2014 02:08:55 +0000 (+0100) Subject: Fix invalid pointer dereference. X-Git-Tag: libsigrok-0.4.0~731 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a9b2283fd038a2a8c3e2dc1ede4fcc51d5e62c7c;p=libsigrok.git Fix invalid pointer dereference. --- diff --git a/src/analog.c b/src/analog.c index fba7830f..9e01566f 100644 --- a/src/analog.c +++ b/src/analog.c @@ -180,11 +180,11 @@ SR_API int sr_analog_float_to_string(float value, int digits, char **result) /* This produces at least one too many digits */ *result = g_strdup_printf("%.*f", digits, value); - for (i = 0, cnt = 0; *result[i]; i++) { - if (isdigit(*result[i++])) + for (i = 0, cnt = 0; (*result)[i]; i++) { + if (isdigit((*result)[i++])) cnt++; if (cnt == digits) { - *result[i] = 0; + (*result)[i] = 0; break; } }