From 8d395b942bb6bfbff995e52bbaef7f5f06f887fe Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Tue, 10 Feb 2026 16:31:00 +0100 Subject: [PATCH] [primitives,test] replace sscanf --- libfreerdp/primitives/test/TestPrimitivesYUV.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/libfreerdp/primitives/test/TestPrimitivesYUV.c b/libfreerdp/primitives/test/TestPrimitivesYUV.c index 48c5c0d73..0a91c012c 100644 --- a/libfreerdp/primitives/test/TestPrimitivesYUV.c +++ b/libfreerdp/primitives/test/TestPrimitivesYUV.c @@ -1413,10 +1413,21 @@ int TestPrimitivesYUV(int argc, char* argv[]) if (argc > 1) { - // NOLINTNEXTLINE(cert-err34-c) - int crc = sscanf(argv[1], "%" PRIu32 "x%" PRIu32, &roi.width, &roi.height); + BOOL reset = TRUE; + char* str = argv[1]; + char* ptr = strchr(str, 'x'); + if (ptr) + { + *ptr++ = '\0'; - if (crc != 2) + errno = 0; + roi.width = strtoul(str, NULL, 0); + if (errno == 0) + roi.height = strtoul(str, NULL, 0); + reset = errno != 0; + } + + if (reset) { roi.width = 1920; roi.height = 1080;