Bug 14756 - busybox segfaults when argv[0]==NULL
Summary: busybox segfaults when argv[0]==NULL
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-17 17:48 UTC by Thiner Logoer
Modified: 2022-04-17 17:48 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thiner Logoer 2022-04-17 17:48:23 UTC
This is a fairly old bug (feature?)

```
python3 -c "import ctypes;print(ctypes.CDLL('libc.so.6').execve(b'/sbin/busybox',0,0))"
```

This makes busybox segfault. busybox could have a better way to deal with it, for example assume the applet is "" or "busybox" or get the path from `/proc/self/exe`, depending on the case. Even if rejecting argv[0]=NULL is a feature,  `exit(1)` should be better than segfault, as segfault is effectively a ub.