From a9b2283fd038a2a8c3e2dc1ede4fcc51d5e62c7c Mon Sep 17 00:00:00 2001 From: Bert Vermeulen Date: Thu, 20 Nov 2014 03:08:55 +0100 Subject: [PATCH] Fix invalid pointer dereference. --- src/analog.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; } }