From 56cecec5611f3b661f214632474aa3ac4f3f4f6f Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 11 Jan 2014 11:05:12 +0100 Subject: [PATCH] kmod: add patch from sabotage to make this build with musl. --- srcpkgs/kmod/patches/kmod.patch | 32 ++++++++++++++++++++++++++++++++ srcpkgs/kmod/template | 7 ++----- 2 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 srcpkgs/kmod/patches/kmod.patch diff --git a/srcpkgs/kmod/patches/kmod.patch b/srcpkgs/kmod/patches/kmod.patch new file mode 100644 index 00000000000..86ef61c2c45 --- /dev/null +++ b/srcpkgs/kmod/patches/kmod.patch @@ -0,0 +1,32 @@ +remove non-portable usage of strndupa + +usage of strndupa is neither C99 nor POSIX, +it's a glibc invention, and a dangerous one since +alloca() is used behind the scenes which does not +give any guarantuees that it won't overflow the +stack. + +--- libkmod/libkmod-util.c 2013-08-26 16:03:22.239000003 +0000 ++++ libkmod/libkmod-util.c 2013-08-26 16:07:26.684000003 +0000 +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + #include + + #include "libkmod.h" +@@ -323,8 +324,11 @@ + int mkdir_p(const char *path, int len, mode_t mode) + { + char *start, *end; +- +- start = strndupa(path, len); ++ char buf[PATH_MAX+1]; ++ snprintf(buf, sizeof buf, "%s", path); ++ assert(len < sizeof(buf)); ++ buf[len] = 0; ++ start = buf; + end = start + len; + + /* diff --git a/srcpkgs/kmod/template b/srcpkgs/kmod/template index 5553cd283ed..af24b017e53 100644 --- a/srcpkgs/kmod/template +++ b/srcpkgs/kmod/template @@ -1,7 +1,7 @@ # Template file for 'kmod' pkgname=kmod version=16 -revision=1 +revision=2 build_style=gnu-configure configure_args="--with-zlib --with-xz" hostmakedepends="pkg-config libxslt" @@ -17,9 +17,6 @@ license="GPL-2" homepage="http://git.profusion.mobi/cgit.cgi/kmod.git" distfiles="${KERNEL_SITE}/utils/kernel/kmod/kmod-${version}.tar.xz" checksum=63412efab37c70459ccef167556965c93fd4f56af5986cd3750542a684c613c5 -long_desc=" - kmod is a set of tools to handle common tasks with Linux kernel modules like - insert, remove, list, check properties, resolve dependencies and aliases." if [ "$CROSS_BUILD" ]; then hostmakedepends+=" libtool automake" @@ -46,7 +43,7 @@ libkmod_package() { } libkmod-devel_package() { - depends="zlib-devel liblzma-devel libkmod>=${version}" + depends="zlib-devel liblzma-devel libkmod>=${version}_${revision}" short_desc+=" - development files" pkg_install() { vmove usr/include