aboutsummaryrefslogtreecommitdiff
path: root/tests/server/rtspd.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2010-02-16 11:17:00 +0000
committerYang Tse <yangsita@gmail.com>2010-02-16 11:17:00 +0000
commitf442dd6496c8710c4000a078e8085238fdaa7545 (patch)
tree57750b13bbd750e693304920fa5a09e170ccdee9 /tests/server/rtspd.c
parentbb2d9c3704c687a644f62fbc17c0a0a26bf406eb (diff)
fix Content-Length validation
Diffstat (limited to 'tests/server/rtspd.c')
-rw-r--r--tests/server/rtspd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/server/rtspd.c b/tests/server/rtspd.c
index c10b829aa..56111bd26 100644
--- a/tests/server/rtspd.c
+++ b/tests/server/rtspd.c
@@ -581,10 +581,12 @@ static int ProcessRequest(struct httprequest *req)
char *endptr;
char *ptr = line + 15;
unsigned long clen = 0;
- while(*ptr && (' ' == *ptr))
+ while(*ptr && ISSPACE(*ptr))
ptr++;
+ endptr = ptr;
+ SET_ERRNO(0);
clen = strtoul(ptr, &endptr, 10);
- if((ptr == endptr) || ERRNO) {
+ if((ptr == endptr) || !ISSPACE(*endptr) || (ERANGE == ERRNO)) {
/* this assumes that a zero Content-Length is valid */
logmsg("Found invalid Content-Length: (%s) in the request", ptr);
req->open = FALSE; /* closes connection */