summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog4
-rw-r--r--src/readelf.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 05b2522d..263e9faa 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
+2021-12-04 Mark Wielaard <mark@klomp.org>
+
+ * readelf.c (print_ehdr): Pass sizeof (buf) - 1 to strncpy.
+
2021-10-20 John M Mellor-Crummey <johnmc@rice.edu>
* readelf.c (print_debug_line_section): Try to read
diff --git a/src/readelf.c b/src/readelf.c
index c10038e3..93fb5989 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -1172,7 +1172,7 @@ print_ehdr (Ebl *ebl, GElf_Ehdr *ehdr)
(uint32_t) shdr->sh_link);
else
{
- strncpy (buf, _(" ([0] not available)"), sizeof (buf));
+ strncpy (buf, _(" ([0] not available)"), sizeof (buf) - 1);
buf[sizeof (buf) - 1] = '\0';
}