Skip to content

Instantly share code, notes, and snippets.

@ktgw0316
Last active February 22, 2021 14:17
Show Gist options
  • Select an option

  • Save ktgw0316/1caee7326bb9cf9e191ff6267d3fe342 to your computer and use it in GitHub Desktop.

Select an option

Save ktgw0316/1caee7326bb9cf9e191ff6267d3fe342 to your computer and use it in GitHub Desktop.
lensfun de954c9
diff --git a/libs/lensfun/lens.cpp b/libs/lensfun/lens.cpp
index 52b76658..ec99da4b 100644
--- a/libs/lensfun/lens.cpp
+++ b/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);
diff --git a/libs/lensfun/mount.cpp b/libs/lensfun/mount.cpp
index bd875baa..1df01dbe 100644
--- a/libs/lensfun/mount.cpp
+++ b/libs/lensfun/mount.cpp
@@ -60,7 +60,7 @@ void lfMount::AddCompat (const char *val)
{
if (val)
{
- char* p = (char*)malloc(strlen(val));
+ char* p = (char*)malloc(strlen(val) + 1);
strcpy(p, val);
MountCompat.push_back(p);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment