1407934 Unchecked return value
If the function returns an error value, the error value may be mistaken for a normal value.
In parse_arguments: Value returned from a function is not checked for errors before being used (CWE-252)
Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I26e4d324c97833acedab4ebd030d412848dcbfe4
static
int parse_arguments(char **argv)
{
+ int sscanf_ret;
const char *domain_type_string = NULL;
const char *buffer_usage_type_string = NULL;
const char *buffer_usage_threshold_type = NULL;
}
/* Number of notification to expect */
- sscanf(nr_expected_notifications_string, "%d", &nr_expected_notifications);
+ sscanf_ret = sscanf(nr_expected_notifications_string, "%d",
+ &nr_expected_notifications);
+ if (sscanf_ret != 1) {
+ printf("error: Invalid nr_expected_notifications, sscanf returned %d\n",
+ sscanf_ret);
+ goto error;
+ }
return 0;
error: