Introduction
Introduction Statistics Contact Development Disclaimer Help
A more liberal input string handling. - geomyidae - A small C-based gopherd.
git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfri…
Log
Files
Refs
Tags
README
LICENSE
---
commit 15637a95cdfd6cda10f147ad8cfb56ae16a4abea
parent b3b6d54e4122244a89b50987b122a135b6b40586
Author: Christoph Lohmann <[email protected]>
Date: Sat, 12 May 2012 09:12:40 +0200
A more liberal input string handling.
Diffstat:
M main.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/main.c b/main.c
@@ -140,12 +140,15 @@ handlerequest(int sock, char *base, char *ohost, char *po…
args = nil;
len = recv(sock, recvb, sizeof(recvb)-1, 0);
- if(len > 0) {
- if(recvb[len - 2] == '\r')
- recvb[len - 2] = '\0';
- if(recvb[len - 1] == '\n')
- recvb[len - 1] = '\0';
- }
+ if (len <= 0)
+ return;
+
+ c = strchr(recvb, '\r');
+ if(c)
+ c[0] = '\0';
+ c = strchr(recvb, '\n');
+ if(c)
+ c[0] = '\0';
memmove(recvc, recvb, len+1);
if(!strncmp(recvb, "URL:", 4)) {
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.