diff mbox

[uclibc-ng-devel] librt: fix path parsing in __spawni()

Message ID 1470761327-6398-1-git-send-email-eric.le.bihan.dev@free.fr
State Accepted
Headers show

Commit Message

Eric Le Bihan Aug. 9, 2016, 4:48 p.m. UTC
__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>
---
 librt/spawn.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Waldemar Brodkorb Aug. 12, 2016, 5:32 a.m. UTC | #1
Hi Eric,
Eric Le Bihan wrote,

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

Thanks. Patch applied and pushed,

 best regards
  Waldemar
diff mbox

Patch

diff --git a/librt/spawn.c b/librt/spawn.c
index 79f5b06..25e3994 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: