groff/0008-Fix-for-insufficient-allocation-of-iterator.patch
Lukas Javorsky 110a111914 Fixing SAST reports
Resolves: RHEL-45003
2024-08-21 11:57:10 +00:00

26 lines
730 B
Diff

From 2e548049590a455ce3824fa7950f03465b737501 Mon Sep 17 00:00:00 2001
From: Lukas Javorsky <ljavorsk@redhat.com>
Date: Thu, 1 Aug 2024 10:48:45 +0200
Subject: [PATCH 2/7] Fix for insufficient allocation of iterator
---
src/roff/troff/input.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/roff/troff/input.cpp b/src/roff/troff/input.cpp
index abf6198..18157a9 100644
--- a/src/roff/troff/input.cpp
+++ b/src/roff/troff/input.cpp
@@ -3630,9 +3630,10 @@ inline
#endif
temp_iterator::temp_iterator(const char *s, int len)
{
- base = new unsigned char[len];
+ base = new unsigned char[len + 1];
if (len > 0)
memcpy(base, s, len);
+ base[len] = '\0';
ptr = base;
eptr = base + len;
}