about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2010-05-02 12:12:55 -0700
committerPetr Baudis <pasky@ucw.cz>2010-05-12 03:21:20 +0200
commit850121f39d8b0bcf1e5bb2bddd4b50aae708b661 (patch)
tree871fdde839670dbe6703ad604a4fccaacb2c0a46
parent15290d70863d800087aa629f035ad4bcb7f1f69b (diff)
downloadglibc-850121f39d8b0bcf1e5bb2bddd4b50aae708b661.tar.gz
glibc-850121f39d8b0bcf1e5bb2bddd4b50aae708b661.tar.xz
glibc-850121f39d8b0bcf1e5bb2bddd4b50aae708b661.zip
Fix handling if newline in addmntent.
(cherry picked from commit ab00f4eac8f4932211259ff87be83144f5211540)
-rw-r--r--ChangeLog6
-rw-r--r--misc/mntent_r.c6
2 files changed, 9 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 3d9f1b5f94..eb9a577918 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-05-02  Ulrich Drepper  <drepper@redhat.com>
+
+	* misc/mntent_r.c (encode_name): The slow loop handles newlines so we
+	should recognize them as an abort condition.
+	Patch by Jan Lieskovsky <jlieskov@redhat.com>.
+
 2010-04-25  Bruno Haible  <bruno@clisp.org>
 
 	[BZ #11538]
diff --git a/misc/mntent_r.c b/misc/mntent_r.c
index 829750b395..9598528324 100644
--- a/misc/mntent_r.c
+++ b/misc/mntent_r.c
@@ -1,5 +1,5 @@
 /* Utilities for reading/writing fstab, mtab, etc.
-   Copyright (C) 1995-2000, 2001, 2002, 2003, 2006
+   Copyright (C) 1995-2000, 2001, 2002, 2003, 2006, 2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -194,7 +194,7 @@ weak_alias (__getmntent_r, getmntent_r)
     const char *rp = name;						      \
 									      \
     while (*rp != '\0')							      \
-      if (*rp == ' ' || *rp == '\t' || *rp == '\\')			      \
+      if (*rp == ' ' || *rp == '\t' || *rp == '\n' || *rp == '\\')	      \
 	break;								      \
       else								      \
 	++rp;								      \
@@ -202,7 +202,7 @@ weak_alias (__getmntent_r, getmntent_r)
     if (*rp != '\0')							      \
       {									      \
 	/* In the worst case the length of the string can increase to	      \
-	   founr times the current length.  */				      \
+	   four times the current length.  */				      \
 	char *wp;							      \
 									      \
 	rp = name;							      \