aboutsummaryrefslogtreecommitdiffstats
path: root/main/cdparanoia/no-cuserid.patch
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2020-02-12 20:34:37 +0100
committerSören Tempel <soeren+git@soeren-tempel.net>2020-02-12 21:31:14 +0100
commitde10d698c771916add10ea54c5c63d1f37860e9d (patch)
treedb7fab5c35c02edc52979cae9a5f8597fd3987ba /main/cdparanoia/no-cuserid.patch
parente43c2c7582aaa5de534ce83f2da2a540f4a0f78c (diff)
downloadaports-de10d698c771916add10ea54c5c63d1f37860e9d.tar.bz2
aports-de10d698c771916add10ea54c5c63d1f37860e9d.tar.xz
main/cdparanoia: fix segmentation fault
This occurs when no CD drives are accessible to the user as musl does not support invoking cuserid with a NULL pointer argument.
Diffstat (limited to 'main/cdparanoia/no-cuserid.patch')
-rw-r--r--main/cdparanoia/no-cuserid.patch32
1 files changed, 32 insertions, 0 deletions
diff --git a/main/cdparanoia/no-cuserid.patch b/main/cdparanoia/no-cuserid.patch
new file mode 100644
index 0000000000..dd6417f836
--- /dev/null
+++ b/main/cdparanoia/no-cuserid.patch
@@ -0,0 +1,32 @@
+Since IEEE 1003.1-1988 cuserid is not standardized anymore. The musl
+libc, used by Alpine Linux, currently does not supporting using it with
+a NULL pointer argument [1]. Doing so causes a segmentation fault, to
+fix this remove use of cuserid entirely. This is currently achieved by
+not including the user name in the error message, while it would be
+possible to achieve the same output using getpwuid(geteuid()) this
+requires error handling and would make the patch more complicated.
+
+[1]: https://www.openwall.com/lists/musl/2020/01/29/2
+
+diff -upr cdparanoia-III-10.2.orig/interface/scan_devices.c cdparanoia-III-10.2/interface/scan_devices.c
+--- cdparanoia-III-10.2.orig/interface/scan_devices.c 2020-02-12 20:29:46.232958848 +0100
++++ cdparanoia-III-10.2/interface/scan_devices.c 2020-02-12 20:30:06.336297868 +0100
+@@ -6,8 +6,6 @@
+ *
+ ******************************************************************/
+
+-#define _GNU_SOURCE /* get cuserid */
+-#define _USE_XOPEN /* get cuserid */
+ #include <limits.h>
+ #include <stdio.h>
+ #include <unistd.h>
+@@ -93,8 +91,7 @@ cdrom_drive *cdda_find_a_cdrom(int messa
+ i++;
+ }
+ idmessage(messagedest,messages,
+- "\n\nNo cdrom drives accessible to %s found.\n",
+- cuserid(NULL));
++ "\n\nNo cdrom drives accessible to current user found.\n", NULL);
+ return(NULL);
+ }
+