From c61570ac32f052e050c46838ea5ab60de5836f8e Mon Sep 17 00:00:00 2001 From: Eric Le Bihan Date: Tue, 9 Aug 2016 18:48:47 +0200 Subject: 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 --- librt/spawn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/librt/spawn.c b/librt/spawn.c index 79f5b06a7..25e3994e1 100644 --- a/librt/spawn.c +++ b/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: -- cgit v1.2.3