aboutsummaryrefslogtreecommitdiff
path: root/src/nanosvg.h
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-12-19 19:21:01 +0100
committerRodrigo Arias Mallo <rodarima@gmail.com>2025-01-25 14:23:04 +0100
commitd4f7b19cf12710452ff6b70071de0990ad4ac8f7 (patch)
tree8ba75f0793372b35b7e64340f8f5dc4b75ac5b8f /src/nanosvg.h
parent70afa86d8c57d194e370c848540520e7bb034fca (diff)
Fix OOB read in nsvg__parseColorRGB()
nsvg__isspace uses strchr on a NUL terminated string, so it returns true for the NUL terminator. Other uses of nsvg__isspace account for this by checking for NUL first; I've followed the same pattern here. Fixes: https://github.com/memononen/nanosvg/issues/241 See: https://github.com/memononen/nanosvg/pull/262
Diffstat (limited to 'src/nanosvg.h')
-rw-r--r--src/nanosvg.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nanosvg.h b/src/nanosvg.h
index 77617f65..db5382a1 100644
--- a/src/nanosvg.h
+++ b/src/nanosvg.h
@@ -1281,7 +1281,7 @@ static unsigned int nsvg__parseColorRGB(const char* str)
while (*str && nsvg__isdigit(*str)) str++; // skip fractional part
}
if (*str == '%') str++; else break;
- while (nsvg__isspace(*str)) str++;
+ while (*str && nsvg__isspace(*str)) str++;
if (*str == delimiter[i]) str++;
else break;
}