summaryrefslogtreecommitdiffstats
path: root/lib/utils.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-08-18 09:56:58 (GMT)
committerThomas Haller <thaller@redhat.com>2023-08-18 09:57:33 (GMT)
commit8ee8b05ff59999fd88b8a6faae40e7777ccf8c98 (patch)
tree5784b5f09464eea1afeae98462c8799a1f130481 /lib/utils.c
parent09f03f29cf9d26933d2bd319bdeb63f9da9d81e8 (diff)
downloadlibnl-8ee8b05ff59999fd88b8a6faae40e7777ccf8c98.zip
libnl-8ee8b05ff59999fd88b8a6faae40e7777ccf8c98.tar.gz
libnl-8ee8b05ff59999fd88b8a6faae40e7777ccf8c98.tar.bz2
lib: fix error handling in nl_str2ip_proto()
Diffstat (limited to 'lib/utils.c')
-rw-r--r--lib/utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/utils.c b/lib/utils.c
index c46cf51..04bbe81 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -891,7 +891,7 @@ int nl_str2ip_proto(const char *name)
return p->p_proto;
l = strtoul(name, &end, 0);
- if (l == ULONG_MAX || *end != '\0')
+ if (name == end || *end != '\0' || l > (unsigned long)INT_MAX)
return -NLE_OBJ_NOTFOUND;
return (int) l;