commit 79226753f351fbe1536b06073c55ef254bd312a5
parent 9dec636246a3d9af0a5b6e6aa4d5be7e9d46e1e3
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 4 Feb 2026 16:26:37 +0100
Fix a test on available memory space
The size of a temporary buffer was checked against the size of a string
to be copied to it. This test was incorrect, but did not pose a real
problem, as it removed one byte from the total length of the temporary
buffer. Therefore, there was no invalid memory write, just an overly
restrictive test.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/sln_build.c b/src/sln_build.c
@@ -163,7 +163,7 @@ parse_polyline_opt(const char* str, void* ptr)
ASSERT(str && ptr);
- if(strlen(str) >= sizeof(buf) -1/*NULL char*/) {
+ if(strlen(str)+1/*NULL char*/ > sizeof(buf)) {
fprintf(stderr, "could not duplicate polyline option `%s'\n", str);
res = RES_MEM_ERR;
goto error;