about summary refs log tree commit diff
path: root/nss/nss_files/files-parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'nss/nss_files/files-parse.c')
-rw-r--r--nss/nss_files/files-parse.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/nss/nss_files/files-parse.c b/nss/nss_files/files-parse.c
index 8930780f1f..1f3b13886d 100644
--- a/nss/nss_files/files-parse.c
+++ b/nss/nss_files/files-parse.c
@@ -128,8 +128,15 @@ parse_list (char *line, struct parser_data *data, int datalen)
 {
   char *eol, **list, **p;
 
-  /* Find the end of the line buffer.  */
-  eol = strchr (data->linebuffer, '\0') + 1;
+  if (line >= data->linebuffer && line < (char *) data + datalen)
+    /* Find the end of the line buffer, we will use the space in DATA after
+       it for storing the vector of pointers.  */
+    eol = strchr (line, '\0') + 1;
+  else
+    /* LINE does not point within DATA->linebuffer, so that space is
+       not being used for scratch space right now.  We can use all of
+       it for the pointer vector storage.  */
+    eol = data->linebuffer;
   /* Adjust the pointer so it is aligned for storing pointers.  */
   eol += __alignof__ (char *) - 1;
   eol -= (eol - (char *) 0) % __alignof__ (char *);