From 5096180e922d933f1b734443c2100c14b9d16eef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 18 Jan 2024 15:06:47 +0800 Subject: [PATCH] CPU (Linux): don't access out-of-bound memory --- src/detection/cpu/cpu_linux.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/detection/cpu/cpu_linux.c b/src/detection/cpu/cpu_linux.c index 8f33c491e..227af12bb 100644 --- a/src/detection/cpu/cpu_linux.c +++ b/src/detection/cpu/cpu_linux.c @@ -191,6 +191,8 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu) ffStrbufAppendS(&cpu->vendor, pstart); } pstart = pend + 1; + if (pstart >= buffer.chars + buffer.length) + return NULL; } } } @@ -222,6 +224,8 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu) } pstart = pend + 1; + if (pstart >= buffer.chars + buffer.length) + return NULL; } } }