libnl3/backport-fix-error-handling-in-nl_str2ip_protos.patch

29 lines
933 B
Diff
Raw Normal View History

From 8ee8b05ff59999fd88b8a6faae40e7777ccf8c98 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 18 Aug 2023 11:56:58 +0200
Subject: [PATCH] lib: fix error handling in nl_str2ip_proto()
Conflict:Deleted the test case because the check-direct test case does not exist in the current version because it is not integrated into the pre-installation patch bae11ec.
Reference:https://github.com/thom311/libnl/commit/8ee8b05ff59999fd88b8a6faae40e7777ccf8c98
---
lib/utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/utils.c b/lib/utils.c
index 496bf3b..9795b42 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -887,7 +887,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;
--
2.33.0