Patchwork D7234: dirs: reject consecutive slashes in paths

login
register
mail settings
Submitter phabricator
Date Nov. 6, 2019, 3:37 a.m.
Message ID <0dc129bffdd7e78fb79cb3d93bf83581@localhost.localdomain>
Download mbox | patch
Permalink /patch/42778/
State Not Applicable
Headers show

Comments

phabricator - Nov. 6, 2019, 3:37 a.m.
Closed by commit rHG88562eb65232: dirs: reject consecutive slashes in paths (authored by durin42).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7234?vs=17564&id=17583

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7234/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7234

AFFECTED FILES
  mercurial/cext/dirs.c

CHANGE DETAILS




To: durin42, #hg-reviewers, indygreg
Cc: mercurial-devel

Patch

diff --git a/mercurial/cext/dirs.c b/mercurial/cext/dirs.c
--- a/mercurial/cext/dirs.c
+++ b/mercurial/cext/dirs.c
@@ -66,6 +66,11 @@ 
 	while ((pos = _finddir(cpath, pos - 1)) != -1) {
 		PyObject *val;
 
+		/* Sniff for trailing slashes, a marker of an invalid input. */
+		if (cpath[pos - 1] == '/') {
+			goto bail;
+		}
+
 		key = PyBytes_FromStringAndSize(cpath, pos);
 		if (key == NULL)
 			goto bail;