gbranden pushed a commit to branch master
in repository groff.
commit 89c98409d32d01867e6f7cb7ab61efaf7b1da67e
Author: G. Branden Robinson <[email protected]>
AuthorDate: Wed Jan 6 15:34:50 2021 +1100
[libgroff]: (relocatep) Add assertion.
* src/libs/libgroff/relocate.cpp (relocatep): Add assertion to identify
logic error if `curr_prefix` is unexpectedly a null pointer. See
<https://savannah.gnu.org/bugs/?55475>.
---
ChangeLog | 6 ++++++
src/libs/libgroff/relocate.cpp | 2 ++
2 files changed, 8 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 294ab0b..03a23a8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2021-01-06 G. Branden Robinson <[email protected]>
+
+ * src/libs/libgroff/relocate.cpp (relocatep): Add assertion to
+ identify logic error if `curr_prefix` is unexpectedly a null
+ pointer. See <https://savannah.gnu.org/bugs/?55475>.
+
2021-01-06 Colin Watson <[email protected]>
* contrib/glilypond/glilypond.pl:
diff --git a/src/libs/libgroff/relocate.cpp b/src/libs/libgroff/relocate.cpp
index 393fbfc..e505bdf 100644
--- a/src/libs/libgroff/relocate.cpp
+++ b/src/libs/libgroff/relocate.cpp
@@ -21,6 +21,7 @@
#include <errno.h>
#include <stdlib.h>
+#include "assert.h"
#include "defs.h"
#include "posix.h"
#include "nonposix.h"
@@ -212,6 +213,7 @@ char *relocatep(const char *path)
size_t relative_path_len = strlen(relative_path);
char *relocated_path = (char *)malloc(curr_prefix_len
+ relative_path_len + 1);
+ assert(0 != curr_prefix);
strcpy(relocated_path, curr_prefix);
strcat(relocated_path, relative_path);
#if DEBUG
_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit