Subject: lib/2196: re_comp() problem when use it repeatedly
To: None <gnats-bugs@NetBSD.ORG>
From: None <kazusi-m@is.aist-nara.ac.jp>
List: netbsd-bugs
Date: 03/10/1996 08:02:33
>Number: 2196
>Category: lib
>Synopsis: re_comp() don't undersdant a null string
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: lib-bug-people (Library Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Mar 10 09:20:01 1996
>Last-Modified:
>Originator: Kazushi Jam Marukawa
>Organization:
NARA Institute of Science and Technology
>Release: Mar 8, 1996 via ftp.sra.co.jp
>Environment:
System: NetBSD seki.aist-nara.ac.jp 1.1A NetBSD 1.1A (SEKI) #19: Sat Jan 27 07:15:12 JST 1996 jam@seki.aist-nara.ac.jp:/usr/src/sysmine/arch/i386/compile/SEKI i386
>Description:
The manual of re_comp(3) said, "If re_comp() is passed 0 or
a null strings, it returns without changing the currently compiled
regular expression." However the source code doesn't check a null
string. It checks only 0.
>How-To-Repeat:
Sorry, I don't make such thing.
>Fix:
A simple patch is following for
/usr/src/lib/libcompat/4.3/regex.c.
--- /tmp/regex.c.orig Sun Mar 10 22:58:09 1996
+++ /tmp/regex.c Sun Mar 10 22:58:21 1996
@@ -60,7 +60,7 @@
re_comp(s)
const char *s;
{
- if (s == NULL)
+ if (s == NULL || *s == '\0')
return (NULL);
if (re_regexp)
free(re_regexp);
-- Kazushi Jam Marukawa
>Audit-Trail:
>Unformatted: