summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
65f6497)
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: I7733e88ea6af6313379bd8d4ca131cd243cda401
static
int parse_arguments(char **argv)
{
static
int parse_arguments(char **argv)
{
const char *domain_type_string = NULL;
const char *buffer_usage_type_string = NULL;
const char *buffer_usage_threshold_type = NULL;
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 */
}
/* 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;
+ }
/* Put notify action in a group. */
if (!strcasecmp("1", use_action_group_value)) {
/* Put notify action in a group. */
if (!strcasecmp("1", use_action_group_value)) {