Browse Source

librt: fix path parsing in __spawni()

__spawni() loops forever when parsing the path variable due to incorrect
pointer update. This patch fixes the issue.

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
Eric Le Bihan 7 years ago
parent
commit
c61570ac32
1 changed files with 2 additions and 2 deletions
  1. 2 2
      librt/spawn.c

+ 2 - 2
librt/spawn.c

@@ -203,9 +203,10 @@ __spawni(pid_t *pid, const char *file,
 		*--name = '/';
 	}
 
-	char *p;
+	char *p = (char *)path;
 	do {
 		char *startp;
+		path = p;
 		p = strchrnul(path, ':');
 
 		/* Two adjacent colons, or a colon at the beginning or the end
@@ -233,7 +234,6 @@ __spawni(pid_t *pid, const char *file,
 			goto error;
 		}
 
-		path = p;
 	} while (*p++ != '\0');
 
 error: