The CodeQL reported a warning:
"Incorrect return-value check for a 'scanf'-like function"
More information about the warning:
https://github.com/libcgroup/libcgroup/security/code-scanning/18
Fix the warning by adding an additional "EOF" check for the ret value
from sscanf() in the load_list().
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
if (ret == 0)
continue;
+ if (ret == EOF) {
+ ret = ECGEOF;
+ goto err;
+ }
+
new = (struct deny_list_type *) malloc(sizeof(struct deny_list_type));
if (new == NULL) {
err("ERROR: Memory allocation problem (%s)\n", strerror(errno));