[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r6314 - in /fsf/trunk/libc: ChangeLog misc/regexp.h
- To: commits@xxxxxxxxxx
- Subject: [commits] r6314 - in /fsf/trunk/libc: ChangeLog misc/regexp.h
- From: eglibc@xxxxxxxxxx
- Date: Sat, 07 Jun 2008 07:03:59 -0000
Author: eglibc
Date: Sat Jun 7 00:03:58 2008
New Revision: 6314
Log:
Import glibc-mainline for 2008-06-07
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/misc/regexp.h
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sat Jun 7 00:03:58 2008
@@ -1,3 +1,8 @@
+2008-06-05 Jakub Jelinek <jakub@xxxxxxxxxx>
+
+ * misc/regexp.h (compile): Use __REPB_PREFIX macro.
+ Avoid segfault if first GETC returns eof/'\0'/'\n'.
+
2008-06-03 Jakub Jelinek <jakub@xxxxxxxxxx>
* nscd/nscd_getserv_r.c (__nscd_getservbyport_r): Pass cp
Modified: fsf/trunk/libc/misc/regexp.h
==============================================================================
--- fsf/trunk/libc/misc/regexp.h (original)
+++ fsf/trunk/libc/misc/regexp.h Sat Jun 7 00:03:58 2008
@@ -1,4 +1,5 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 1999, 2004, 2008
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
@@ -129,8 +130,9 @@
__expr_ptr = (regex_t *) expbuf;
/* The remaining space in the buffer can be used for the compiled
pattern. */
- __expr_ptr->buffer = expbuf + sizeof (regex_t);
- __expr_ptr->allocated = endbuf - (char *) __expr_ptr->buffer;
+ __expr_ptr->__REPB_PREFIX (buffer) = expbuf + sizeof (regex_t);
+ __expr_ptr->__REPB_PREFIX (allocated)
+ = endbuf - (char *) __expr_ptr->__REPB_PREFIX (buffer);
while ((__ch = (GETC ())) != eof)
{
@@ -162,7 +164,10 @@
}
__input_buffer[__current_size++] = __ch;
}
- __input_buffer[__current_size++] = '\0';
+ if (__current_size)
+ __input_buffer[__current_size++] = '\0';
+ else
+ __input_buffer = "";
/* Now compile the pattern. */
__error = regcomp (__expr_ptr, __input_buffer, REG_NEWLINE);
@@ -198,7 +203,8 @@
}
/* Everything is ok. */
- RETURN ((char *) (__expr_ptr->buffer + __expr_ptr->used));
+ RETURN ((char *) (__expr_ptr->__REPB_PREFIX (buffer)
+ + __expr_ptr->__REPB_PREFIX (used)));
}
#endif