Skip to content

Commit

Permalink
Fix handling if newline in addmntent.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Drepper committed May 2, 2010
1 parent 8c0677f commit ab00f4e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
6 changes: 3 additions & 3 deletions misc/mntent_r.c
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -194,15 +194,15 @@ 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; \
\
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; \
Expand Down

0 comments on commit ab00f4e

Please sign in to comment.