public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 2/2] linux: posix_spawn: return EINVAL on argc < 1
@ 2022-01-28 13:39 Cristian Rodríguez
  2022-01-28 15:26 ` Cristian Rodríguez
  0 siblings, 1 reply; 11+ messages in thread
From: Cristian Rodríguez @ 2022-01-28 13:39 UTC (permalink / raw)
  To: libc-alpha

posix_spawn allows argc < 1 but the specification says that
"The value in argv[0] should point to a filename string.."
So there must be at least one non-null argument.

Signed-off-by: Cristian Rodríguez <crrodriguez@opensuse.org>
---
 sysdeps/unix/sysv/linux/spawni.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c
index 93359c708b..23617c9165 100644
--- a/sysdeps/unix/sysv/linux/spawni.c
+++ b/sysdeps/unix/sysv/linux/spawni.c
@@ -334,6 +334,11 @@ __spawnix (pid_t * pid, const char *file,
 	errno = E2BIG;
 	return errno;
       }
+    if (argc < 1)
+      {
+	errno = EINVAL;
+	return errno;
+      }
 
   int prot = (PROT_READ | PROT_WRITE
 	     | ((GL (dl_stack_flags) & PF_X) ? PROT_EXEC : 0));
-- 
2.34.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-03-23 14:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-28 13:39 [PATCH 2/2] linux: posix_spawn: return EINVAL on argc < 1 Cristian Rodríguez
2022-01-28 15:26 ` Cristian Rodríguez
2022-01-28 17:07   ` Adhemerval Zanella
2022-01-28 18:03     ` Joseph Myers
2022-01-28 23:05       ` Adhemerval Zanella
2022-01-28 23:26         ` Joseph Myers
2022-01-28 23:35           ` Cristian Rodríguez
2022-01-28 23:49             ` Joseph Myers
2022-01-29  1:04               ` Cristian Rodríguez
2022-03-23 14:40                 ` Cristian Rodríguez
2022-01-28 19:08     ` Cristian Rodríguez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).