Doug Hogan found an off-by-one. More improvements will follow.
-/* $OpenBSD: httpd.c,v 1.4 2014/07/23 22:02:02 reyk Exp $ */
+/* $OpenBSD: httpd.c,v 1.5 2014/07/23 22:56:00 reyk Exp $ */
/*
* Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org>
start = p;
end = p + (len - 1);
- /* Set path pointer and make sure that we start with '/' */
- *p = '\0';
-
- while (*i != '\0' && p <= end) {
+ while (*i != '\0' && p < end) {
/* 1. check for special path elements */
if (i[0] == '/') {
if (i[1] == '/') {