Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/3/84; site panda.UUCP Path: utzoo!decvax!genrad!panda!sources-request From: sources-request@panda.UUCP Newsgroups: mod.sources Subject: bug in regexp(3), and fix Message-ID: <1379@panda.UUCP> Date: Thu, 6-Feb-86 09:16:21 EST Article-I.D.: panda.1379 Posted: Thu Feb 6 09:16:21 1986 Date-Received: Sat, 8-Feb-86 04:57:18 EST Sender: jpn@panda.UUCP Lines: 26 Approved: jpn@panda.UUCP Mod.sources: Volume 3, Issue 105 Submitted by: genrad!decvax!utzoo!henry Drat! Chris Siebenmann at CSRI just found a bug in my regexp(3) routines. The problem is that the code for character classes does not check properly for the possibility that it might be looking at the end of the string. By simple bad luck none of my test cases hit this. To fix it, make the following two changes to regexp.c: 848c848 < if (strchr(OPERAND(scan), *reginput) == NULL) --- > if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) == NULL) 853c853 < if (strchr(OPERAND(scan), *reginput) != NULL) --- > if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) != NULL) and recompile. Also, add the following line to the "tests" file: [k] ab n - - My thanks to Chris for finding this. Henry Spencer @ U of Toronto Zoology {allegra,ihnp4,linus,decvax}!utzoo!henry