Skip to content

Commit

Permalink
Merge pull request #1875 from jan-cerny/strtol_errno
Browse files Browse the repository at this point in the history
Reset errno before strtol
  • Loading branch information
matusmarhefka authored Jul 26, 2022
2 parents 963edcd + 55b09ba commit 8467bf1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/OVAL/probes/independent/sql57_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ static int dbURIInfo_parse(dbURIInfo_t *info, const char *conn)
matchitem1(tok, 'c',
"onnecttimeout", tmp);
if (tmp != NULL) {
errno = 0;
info->conn_timeout = strtol(tmp, NULL, 10);

if (errno == ERANGE || errno == EINVAL)
Expand Down
1 change: 1 addition & 0 deletions src/OVAL/probes/independent/sql_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ static int dbURIInfo_parse(dbURIInfo_t *info, const char *conn)
matchitem1(tok, 'c',
"onnecttimeout", tmp);
if (tmp != NULL) {
errno = 0;
info->conn_timeout = strtol(tmp, NULL, 10);

if (errno == ERANGE || errno == EINVAL)
Expand Down
1 change: 1 addition & 0 deletions src/OVAL/probes/oval_fts.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,7 @@ OVAL_FTS *oval_fts_open_prefixed(const char *prefix, SEXP_t *path, SEXP_t *filen
/* max_depth */
PROBE_ENT_AREF(behaviors, r0, "max_depth", return NULL;);
SEXP_string_cstr_r(r0, cstr_buff, sizeof cstr_buff - 1);
errno = 0;
max_depth = strtol(cstr_buff, NULL, 10);
if (errno == EINVAL || errno == ERANGE) {
dE("Invalid value of the `%s' attribute: %s", "recurse_direction", cstr_buff);
Expand Down
1 change: 1 addition & 0 deletions src/OVAL/probes/unix/xinetd_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,7 @@ int op_assign_bool(void *var, char *val)
*((bool *)(var)) = false;
} else {
char *endptr = NULL;
errno = 0;
*((bool *)(var)) = (bool) strtol (val, &endptr, 2);
if (errno == EINVAL || errno == ERANGE) {
return -1;
Expand Down

0 comments on commit 8467bf1

Please sign in to comment.