Fix uparse to deal explicitely with empty lines. - irc - Unnamed repository; ed… | |
git clone git://vernunftzentrum.de/irc.git | |
Log | |
Files | |
Refs | |
README | |
--- | |
commit 9ec61b4072285e36baeab8f1ac6d819f9445b56c | |
parent 15ec7fd992fc9943740da3d90aec084e13b4392e | |
Author: Quentin Carbonneaux <[email protected]> | |
Date: Sat, 17 Mar 2012 22:37:15 +0100 | |
Fix uparse to deal explicitely with empty lines. | |
Uparse accessed undefined elements if the input line was empty. This was | |
harmless because the default branch of the switch led the control flow | |
to the right place, however it could appear a bit obscure. Adding an | |
extra test will not hurt performance and make the code easier to read. | |
Diffstat: | |
irc.c | 2 +- | |
1 file changed, 1 insertion(+), 1 deletion(-) | |
--- | |
diff --git a/irc.c b/irc.c | |
@@ -265,7 +265,7 @@ uparse(char *m) | |
{ | |
char *p=m; | |
- if (p[1]!=' ' && p[1]!=0) { | |
+ if (!p[0] || (p[1]!=' ' && p[1]!=0)) { | |
pmsg: | |
if (ch==0) return; | |
m+=strspn(m, " "); |