aboutsummaryrefslogtreecommitdiffstats
path: root/main/busybox/0012-microcom-segfault.patch
diff options
context:
space:
mode:
authorMarian Buschsieweke <marian.buschsieweke@ovgu.de>2017-08-03 07:07:52 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2017-08-03 10:45:26 +0000
commit829a46e579053774659b381f0a04cfda2bb6da72 (patch)
tree389973c242a87799955b9c59a9da30ea56b9b72f /main/busybox/0012-microcom-segfault.patch
parentc89b0d14449dee95a6bd3136584ba12f0422a986 (diff)
downloadaports-829a46e579053774659b381f0a04cfda2bb6da72.tar.gz
aports-829a46e579053774659b381f0a04cfda2bb6da72.tar.bz2
aports-829a46e579053774659b381f0a04cfda2bb6da72.tar.xz
main/busybox: Fixed segfault in microcom
microcom does not check if required parameter "TTY" is present. Thus, bb_basename() is called with a NULL pointer, if microcom is started without any parameter. This in turn calls strlen() on this NULL pointer, resulting in a segfault. The supplied patch adds a check for the missing TTY parameter and prints usage when it is missing.
Diffstat (limited to 'main/busybox/0012-microcom-segfault.patch')
-rw-r--r--main/busybox/0012-microcom-segfault.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/main/busybox/0012-microcom-segfault.patch b/main/busybox/0012-microcom-segfault.patch
new file mode 100644
index 0000000000..4789079b35
--- /dev/null
+++ b/main/busybox/0012-microcom-segfault.patch
@@ -0,0 +1,31 @@
+From fd8a0116a29ea4014fac7fbdba2636fc7b51ffc2 Mon Sep 17 00:00:00 2001
+From: Marian Buschsieweke <marian.buschsieweke@ovgu.de>
+Date: Wed, 2 Aug 2017 23:36:08 +0200
+Subject: [PATCH] miscutils/microcom: Fixed segfault
+
+microcom did not check if required parameter TTY is present. Thus,
+bb_basename() was called with a NULL pointer if TTY was missing.
+This commit adds the missing check.
+---
+ miscutils/microcom.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/miscutils/microcom.c b/miscutils/microcom.c
+index 14b9f3baf..38f6425c1 100644
+--- a/miscutils/microcom.c
++++ b/miscutils/microcom.c
+@@ -78,6 +78,11 @@ int microcom_main(int argc UNUSED_PARAM, char **argv)
+ // argc -= optind;
+ argv += optind;
+
++ if (*argv == NULL){
++ bb_show_usage();
++ return EXIT_FAILURE;
++ }
++
+ // try to create lock file in /var/lock
+ device_lock_file = (char *)bb_basename(argv[0]);
+ device_lock_file = xasprintf("/var/lock/LCK..%s", device_lock_file);
+--
+2.13.3
+