# HG changeset patch # User rbultje # Date 1237865099 0 # Node ID c18ea19a977187020b1c11f7df725956287c2f81 # Parent 99c0c6d046d8671edd1635425c22462a0405c81a strchr(string, '\0') returns non-NULL, and is thus not suited for use in redir_isspace(char) to check if '\0' is a space or not. Therefore, we now use memchr(), since then we can give the length of the string (i.e. the length excluding the terminating '\0'). Fixes issue 919, see also the follow-ups in the "[PATCH] rtsp.c small cleanups" mailinglist thread. diff -r 99c0c6d046d8 -r c18ea19a9771 rtsp.c --- a/rtsp.c Sun Mar 22 23:13:21 2009 +0000 +++ b/rtsp.c Tue Mar 24 03:24:59 2009 +0000 @@ -55,7 +55,9 @@ } #define SPACE_CHARS " \t\r\n" -#define redir_isspace(c) strchr(SPACE_CHARS, c) +/* we use memchr() instead of strchr() here because strchr() will return + * the terminating '\0' of SPACE_CHARS instead of NULL if c is '\0'. */ +#define redir_isspace(c) memchr(SPACE_CHARS, c, 4) static void skip_spaces(const char **pp) { const char *p;