From a27b62a0075be1caf6e9d611b424f54153a787b3 Mon Sep 17 00:00:00 2001 From: reyk Date: Wed, 23 Jul 2014 22:56:00 +0000 Subject: [PATCH] I wanted to know if people pay attention. Doug Hogan found an off-by-one. More improvements will follow. --- usr.sbin/httpd/httpd.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/usr.sbin/httpd/httpd.c b/usr.sbin/httpd/httpd.c index f370007fa90..c5a968cc02e 100644 --- a/usr.sbin/httpd/httpd.c +++ b/usr.sbin/httpd/httpd.c @@ -1,4 +1,4 @@ -/* $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 @@ -490,10 +490,7 @@ canonicalize_path(const char *root, const char *input, char *path, size_t len) 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] == '/') { -- 2.20.1