This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: [patch] regex bug fix.
- To: drepper at happy dot cygnus dot com
- Subject: Re: [patch] regex bug fix.
- From: Isamu Hasegawa <isamu at yamato dot ibm dot com>
- Date: Fri, 30 Mar 2001 16:19:26 +0900 (JST)
- Cc: libc-alpha at sourceware dot cygnus dot com, shoji at jp dot ibm dot com
- References: <200103300528.VAA07857@happy.cygnus.com>
Sorry, my patch isn't appropriate if malloc failes.
How about following fix?
2001-03-30 Isamu Hasegawa <isamu@yamato.ibm.com>
* posix/regex.c: Avoid an access violation if malloc failes.
--- glibc/posix/regex.c.95 Fri Mar 30 16:03:10 2001
+++ glibc/posix/regex.c Fri Mar 30 16:03:46 2001
@@ -2339,7 +2339,6 @@ regex_compile (pattern, size, syntax, bu
#ifdef MBS_SUPPORT
/* Initialize the wchar_t PATTERN and offset_buffer. */
p = pend = pattern = TALLOC(csize + 1, CHAR_TYPE);
- pattern[csize] = L'\0'; /* sentinel */
mbs_offset = TALLOC(csize + 1, int);
is_binary = TALLOC(csize + 1, char);
if (pattern == NULL || mbs_offset == NULL || is_binary == NULL)
@@ -2349,6 +2348,7 @@ regex_compile (pattern, size, syntax, bu
free(is_binary);
return REG_ESPACE;
}
+ pattern[csize] = L'\0'; /* sentinel */
size = convert_mbs_to_wcs(pattern, cpattern, csize, mbs_offset, is_binary);
pend = p + size;
if (size < 0)