From 24ab4b297ff2abaebdb6d6795c45a53c02988b9a Mon Sep 17 00:00:00 2001 From: akallabeth Date: Tue, 29 Oct 2024 16:25:53 +0100 Subject: [PATCH] [utils,string] fix freerdp_extract_key_value reset errno before strtoul to avoid aborting due to a previous errno value from a different function call --- libfreerdp/utils/string.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libfreerdp/utils/string.c b/libfreerdp/utils/string.c index 8da8f6d36..f7c97e206 100644 --- a/libfreerdp/utils/string.c +++ b/libfreerdp/utils/string.c @@ -112,10 +112,12 @@ BOOL freerdp_extract_key_value(const char* str, UINT32* pkey, UINT32* pvalue) return FALSE; char* end1 = NULL; + errno = 0; unsigned long key = strtoul(str, &end1, 0); if ((errno != 0) || !end1 || (*end1 != '=') || (key > UINT32_MAX)) return FALSE; + errno = 0; unsigned long val = strtoul(&end1[1], NULL, 0); if ((errno != 0) || (val > UINT32_MAX)) return FALSE;