From 617b5b4c1047423084eb26b4f8d27f7cf6bf4f98 Mon Sep 17 00:00:00 2001 From: jmcneill Date: Sun, 23 Nov 2008 22:28:23 +0000 Subject: From FreeBSD: Fix a problem with PK's strndup() implementation assuming all strings passed to it would be NUL-terminated. This is known to fix crashes with polkit-gnome-authorization and clock-applet. --- security/policykit/distinfo | 3 ++- security/policykit/patches/patch-aj | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 security/policykit/patches/patch-aj (limited to 'security/policykit') diff --git a/security/policykit/distinfo b/security/policykit/distinfo index fc880d7ebc4..31ad6eac416 100644 --- a/security/policykit/distinfo +++ b/security/policykit/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.2 2008/11/23 21:21:43 hasso Exp $ +$NetBSD: distinfo,v 1.3 2008/11/23 22:28:23 jmcneill Exp $ SHA1 (PolicyKit-0.9.tar.gz) = ac99c580eff72f6d5df261c155fb047306439f85 RMD160 (PolicyKit-0.9.tar.gz) = 197262d1c48e55558dd4bd57d7bbd8734666129c @@ -12,3 +12,4 @@ SHA1 (patch-af) = c15988b60a99443469a0399935bc51f99da4b454 SHA1 (patch-ag) = bfa1a32a26d80a3cbc90144ae137d4ad06832e61 SHA1 (patch-ah) = a1ae419a77bb3c8be02706bb67476af9443af92a SHA1 (patch-ai) = 9ec3744b394b0f6181a8a3367f0ce93e32b7fc4f +SHA1 (patch-aj) = 596b9eb54173e25176ba0f363e4b2c4c137dd89f diff --git a/security/policykit/patches/patch-aj b/security/policykit/patches/patch-aj new file mode 100644 index 00000000000..150de873a6a --- /dev/null +++ b/security/policykit/patches/patch-aj @@ -0,0 +1,29 @@ +$NetBSD: patch-aj,v 1.1 2008/11/23 22:28:23 jmcneill Exp $ + +--- src/kit/kit-string.c.orig 2008-05-30 17:24:44.000000000 -0400 ++++ src/kit/kit-string.c 2008-07-24 01:21:34.000000000 -0400 +@@ -123,13 +123,18 @@ static char + if ( !s ) + return NULL; + +- if ( strlen(s) > n ) +- nAvail = n + 1; +- else +- nAvail = strlen(s) + 1; +- p = malloc ( nAvail ); ++ if (memchr(s, '\0', n) != NULL) { ++ nAvail = strlen(s); ++ if ( nAvail > n ) ++ nAvail = n; ++ } else { ++ nAvail = n; ++ } ++ p = malloc ( nAvail + 1 ); ++ if (p == NULL) ++ return NULL; + memcpy ( p, s, nAvail ); +- p[nAvail - 1] = '\0'; ++ p[nAvail] = '\0'; + + return p; + } -- cgit v1.2.3