home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: sparky!uunet!mcsun!Germany.EU.net!Urmel.Informatik.RWTH-Aachen.DE!rama!hadig
- From: hadig@rama.informatik.rwth-aachen.de (Thomas Hadig)
- Subject: Bug in SAS/C 6.0 library : strstr ()
- Message-ID: <hadig.721653082@rama>
- Summary: Bug in strstr (SAS/C 6.0) : strstr can't handle empty strings
- Keywords: strstr, SAS/C 6.0
- Sender: news@Urmel.Informatik.RWTH-Aachen.DE (Newsfiles Owner)
- Nntp-Posting-Host: rama
- Organization: Rechnerbetrieb Informatik / RWTH Aachen
- Date: 13 Nov 92 11:11:22 GMT
- Lines: 31
-
- Hi,
-
- i have found a bug in the SAS/C Amiga 6.0 library function strstr :
-
- char * strstr (char *s1, char *s2);
-
- strstr searches the substring s2 in the string s1 and returns the
- starting address of the substring s2 in s1 or NULL if not found.
-
- BUG :
-
- If you call strstr with an empty string s1, strstr will continue the
- search instead of returning NULL.
-
- Example :
-
- char s1[]="\0test";
- printf ("%d\n",strstr(s1,"test")-s1);
-
- Output will be 1.
-
- (Has been reported to EMITS)
-
- Bye,
- Thomas
-
- ----------------------------------------------------------------------------
- Thomas Hadig, Otto-Petersen-Haus Zi.1009, Ruetscher Str.155, D-51 Aachen
- hadig@rog.rwth-aachen.de
- hadig@pool.informatik.rwth-aachen.de
- ----------------------------------------------------------------------------
-