tunctl: fix segfault on ioctl failure
libbb now takes "" instead of NULL as format string for nomsg functions,
but this caller had not been updated making busybox segfault on tunctl
commands when ioctl fails.
This can be reproduced by running `tunctl -t tun0` in gdb and blocking
with the tun open after being created, and running `tunctl -d tun0` in
another shell: the later will fail with EBUSY after fixing:
> tunctl: Device or resource busy
function old new delta
tunctl_main 393 409 +16
Fixes: 4bd70463c7 ("libbb: pass "" rather than NULL as format string in _nomsg functions")
Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
1 parent
17080dd399
commit
d68f55fc29
2 files changed
+3
-1
No files matched your search
@@ -27,6 +27,8 @@ CFLAGS += $(call cc-option,-Wunused -Wunused-parameter,)
|
||||
CFLAGS += $(call cc-option,-Wunused-function -Wunused-value,)
|
||||
CFLAGS += $(call cc-option,-Wmissing-prototypes -Wmissing-declarations,)
|
||||
CFLAGS += $(call cc-option,-Wno-format-security,)
|
||||
# we use "" format in ioctl_or_perror_and_die(a, b, c, "")
|
||||
CFLAGS += $(call cc-option,-Wno-format-zero-length,)
|
||||
# warn about C99 declaration after statement
|
||||
CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
|
||||
# If you want to add more -Wsomething above, make sure that it is
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@
|
||||
#define TUNSETGROUP _IOW('T', 206, int)
|
||||
#endif
|
||||
|
||||
#define IOCTL(a, b, c) ioctl_or_perror_and_die(a, b, c, NULL)
|
||||
#define IOCTL(a, b, c) ioctl_or_perror_and_die(a, b, c, "")
|
||||
|
||||
#if 1
|
||||
|
||||
|
||||
Reference in new issue
Block a user