$OpenBSD: patch-libgputils_gpreadobj_c,v 1.1.1.1 2003/11/03 01:02:36 naddy Exp $
--- libgputils/gpreadobj.c.orig	2003-10-14 23:21:51.000000000 +1000
+++ libgputils/gpreadobj.c	2003-10-14 23:23:07.000000000 +1000
@@ -142,7 +142,7 @@ _read_section_header(gp_object_type *obj
                      char *file, 
                      char *string_table)
 {
-  char buffer[9];
+  char buffer[9];	/* the name can occupy all 8 chars without a null terminator */
   unsigned int offset;
 
   if (gp_getl32(&file[0]) == 0) {
@@ -150,9 +150,7 @@ _read_section_header(gp_object_type *obj
     offset = gp_getl32(&file[4]);
     section->name = strdup(&string_table[offset]);
   } else {
-    strncpy(buffer, &file[0], 8);
-    /* the name can occupy all 8 chars without a null terminator */
-    buffer[8] = '\0';
+    strlcpy(buffer, &file[0], sizeof(buffer));
     section->name = strdup(buffer);
   }
 
@@ -322,7 +320,7 @@ _read_aux(gp_aux_type *aux, int aux_type
 static void 
 _read_symbol(gp_symbol_type *symbol, char *file, char *string_table)
 {
-  char buffer[9];
+  char buffer[9];	/* the name can occupy all 8 chars without a null terminator */
   unsigned int offset;
 
   if (gp_getl32(&file[0]) == 0) {
@@ -330,9 +328,7 @@ _read_symbol(gp_symbol_type *symbol, cha
     offset = gp_getl32(&file[4]);
     symbol->name = strdup(&string_table[offset]);
   } else {
-    strncpy(buffer, &file[0], 8);
-    /* the name can occupy all 8 chars without a null terminator */
-    buffer[8] = '\0';
+    strlcpy(buffer, &file[0], sizeof(buffer));
     symbol->name = strdup(buffer);
   }
 
