summaryrefslogtreecommitdiff
path: root/libwaitress/src
diff options
context:
space:
mode:
Diffstat (limited to 'libwaitress/src')
-rw-r--r--libwaitress/src/main.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libwaitress/src/main.c b/libwaitress/src/main.c
index ab326cd..a54c864 100644
--- a/libwaitress/src/main.c
+++ b/libwaitress/src/main.c
@@ -122,7 +122,8 @@ char WaitressSplitUrl (const char *url, char *retHost, size_t retHostSize,
lastPos = urlPos;
/* find host */
- while (*urlPos != ':' && *urlPos != '/' && urlPos - lastPos < retHostSize-1) {
+ while (*urlPos != '\0' && *urlPos != ':' && *urlPos != '/' &&
+ urlPos - lastPos < retHostSize-1) {
*retHost++ = *urlPos++;
}
lastPos = urlPos;
@@ -132,14 +133,16 @@ char WaitressSplitUrl (const char *url, char *retHost, size_t retHostSize,
/* skip : */
++urlPos;
++lastPos;
- while (*urlPos != '/' && urlPos - lastPos < retPortSize-1) {
+ while (*urlPos != '\0' && *urlPos != '/' &&
+ urlPos - lastPos < retPortSize-1) {
*retPort++ = *urlPos++;
}
}
lastPos = urlPos;
/* path */
- while (*urlPos != '\0' && *urlPos != '#' && urlPos - lastPos < retPathSize-1) {
+ while (*urlPos != '\0' && *urlPos != '#' &&
+ urlPos - lastPos < retPathSize-1) {
*retPath++ = *urlPos++;
}
} else {