ports/graphics/lensfun/files/patch-libs_lensfun_lens.cpp
Matthias Andree 8fe59c5847 lensfun: allocate buffers for AddMount()/AddCompat() large enough
...so that they can hold the terminating '\0' in C strings.

Found with clang's -fsanitize=address while debugging
RawTherapee 5.8 crashers.

Later found to be already fixed upstream here:
de954c9529

Not handed in for maintainer approval because obviously correct,
maintainer will be notified though.
2020-02-08 13:15:43 +00:00

11 lines
324 B
C++

--- libs/lensfun/lens.cpp.orig 2018-06-29 10:29:17 UTC
+++ libs/lensfun/lens.cpp
@@ -130,7 +130,7 @@ void lfLens::AddMount (const char *val)
{
if (val)
{
- char* p = (char*)malloc(strlen(val));
+ char* p = (char*)malloc(strlen(val) + 1);
strcpy(p, val);
MountNames.push_back(p);