X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Fregression%2Ftools%2Fnotification%2Fbase_client.c;fp=tests%2Fregression%2Ftools%2Fnotification%2Fbase_client.c;h=9b6d30b86731cb638d21f37c77d9932ce18a0b7d;hp=eecdb47885a5520d8a502241ab0a21979af652ca;hb=9d596320136eb060354a686a455ad93639e3861c;hpb=ebdbbd3213366d764522524b22f739eee7889b8b diff --git a/tests/regression/tools/notification/base_client.c b/tests/regression/tools/notification/base_client.c index eecdb4788..9b6d30b86 100644 --- a/tests/regression/tools/notification/base_client.c +++ b/tests/regression/tools/notification/base_client.c @@ -92,12 +92,24 @@ int parse_arguments(char **argv) /* Ratio or bytes ? */ if (!strcasecmp("bytes", buffer_usage_threshold_type)) { is_threshold_ratio = false; - sscanf(buffer_usage_threshold_value, "%" SCNu64, &threshold_bytes); + sscanf_ret = sscanf(buffer_usage_threshold_value, "%" SCNu64, + &threshold_bytes); + if (sscanf_ret != 1) { + printf("error: Invalid buffer usage threshold value bytes (integer), sscanf returned %d\n", + sscanf_ret); + goto error; + } } if (!strcasecmp("ratio", buffer_usage_threshold_type)) { is_threshold_ratio = true; - sscanf(buffer_usage_threshold_value, "%lf", &threshold_ratio); + sscanf_ret = sscanf(buffer_usage_threshold_value, "%lf", + &threshold_ratio); + if (sscanf_ret != 1) { + printf("error: Invalid buffer usage threshold value ratio (float), sscanf returned %d\n", + sscanf_ret); + goto error; + } } /* Number of notification to expect */