Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 26 Mar 2019 09:36:48 +0000
From: Frediano Ziglio <fziglio@...hat.com>
To: musl@...ts.openwall.com
Cc: Frediano Ziglio <fziglio@...hat.com>
Subject: [PATCH 2/2] avoid passing a parameter

Make code slightly smaller.
"file" should not be long and it should fit in NAME_MAX so
this code would be faster only rarely.
---
 src/process/execvp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/process/execvp.c b/src/process/execvp.c
index ef3b9dd5..a2726af9 100644
--- a/src/process/execvp.c
+++ b/src/process/execvp.c
@@ -19,7 +19,7 @@ int __execvpe(const char *file, char *const argv[], char *const envp[])
 		return execve(file, argv, envp);
 
 	if (!path) path = "/usr/local/bin:/bin:/usr/bin";
-	k = strnlen(file, NAME_MAX+1);
+	k = strlen(file);
 	if (k > NAME_MAX) {
 		errno = ENAMETOOLONG;
 		return -1;
-- 
2.20.1

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.