From: Casey West Date: Mon, 3 Nov 2003 10:11:43 +0000 (-0500) Subject: Cwd.xs: off-by-one buffer overflow in realpath() X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7f6e23a86c35581b9f224abd034c75f59268efcf;p=p5sagit%2Fp5-mst-13.2.git Cwd.xs: off-by-one buffer overflow in realpath() Message-ID: <20031103151143.GB430@geeknest.com> p4raw-id: //depot/perl@21646 --- diff --git a/ext/Cwd/Cwd.xs b/ext/Cwd/Cwd.xs index 3f7b93b..4600fef 100644 --- a/ext/Cwd/Cwd.xs +++ b/ext/Cwd/Cwd.xs @@ -166,7 +166,7 @@ loop: rootd = 0; if (*wbuf) { - if (strlen(resolved) + strlen(wbuf) + rootd + 1 > MAXPATHLEN) { + if (strlen(resolved) + strlen(wbuf) + (1 - rootd) + 1 > MAXPATHLEN) { errno = ENAMETOOLONG; goto err1; }