diff options
author | Tycho Andersen <tycho@docker.com> | 2017-06-26 10:10:29 -0600 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2017-06-30 21:58:28 +0000 |
commit | 423d985345f88d243304e6b10190c4945cd4a2a9 (patch) | |
tree | 84f7ae38ffb960cf0d342f94c4f778b759be0eaf /testing/audit/0003-all-get-rid-of-strndupa.patch | |
parent | d9a08c9eb9b5086206823954c5bfef5f12ec0a4b (diff) | |
download | aports-423d985345f88d243304e6b10190c4945cd4a2a9.tar.bz2 aports-423d985345f88d243304e6b10190c4945cd4a2a9.tar.xz |
testing/audit: promote to main
Signed-off-by: Tycho Andersen <tycho@docker.com>
Diffstat (limited to 'testing/audit/0003-all-get-rid-of-strndupa.patch')
-rw-r--r-- | testing/audit/0003-all-get-rid-of-strndupa.patch | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/testing/audit/0003-all-get-rid-of-strndupa.patch b/testing/audit/0003-all-get-rid-of-strndupa.patch deleted file mode 100644 index d34bf0cfb7..0000000000 --- a/testing/audit/0003-all-get-rid-of-strndupa.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 38d950e468c1e51937530f884b138076e4897da2 Mon Sep 17 00:00:00 2001 -From: Tycho Andersen <tycho@docker.com> -Date: Mon, 13 Mar 2017 16:40:08 -0700 -Subject: [PATCH 3/4] all: get rid of strndupa - -in one case (src/auditd.c) we don't even need to allocate a buffer, in the -other two we do it in two steps to avoid using a non-standard function. - -Signed-off-by: Tycho Andersen <tycho@docker.com> ---- - auparse/auparse.c | 6 ++++-- - src/auditd.c | 10 +++++----- - src/ausearch-lol.c | 6 ++++-- - 3 files changed, 13 insertions(+), 9 deletions(-) - -diff --git a/auparse/auparse.c b/auparse/auparse.c -index 058f544..f61d204 100644 ---- a/auparse/auparse.c -+++ b/auparse/auparse.c -@@ -1102,10 +1102,12 @@ static int extract_timestamp(const char *b, au_event_t *e) - int rc = 1; - - e->host = NULL; -+ -+ tmp = alloca(340); - if (*b == 'n') -- tmp = strndupa(b, 340); -+ tmp = strncpy(tmp, b, 340); - else -- tmp = strndupa(b, 80); -+ tmp = strncpy(tmp, b, 80); - ptr = audit_strsplit(tmp); - if (ptr) { - // Optionally grab the node - may or may not be included -diff --git a/src/auditd.c b/src/auditd.c -index cd49758..2de065a 100644 ---- a/src/auditd.c -+++ b/src/auditd.c -@@ -185,7 +185,7 @@ static void child_handler2( int sig ) - - static int extract_type(const char *str) - { -- const char *tptr, *ptr2, *ptr = str; -+ const char *ptr2, *ptr = str; - if (*str == 'n') { - ptr = strchr(str+1, ' '); - if (ptr == NULL) -@@ -194,12 +194,12 @@ static int extract_type(const char *str) - } - // ptr should be at 't' - ptr2 = strchr(ptr, ' '); -- // get type=xxx in a buffer -- tptr = strndupa(ptr, ptr2 - ptr); -+ - // find = -- str = strchr(tptr, '='); -- if (str == NULL) -+ str = strchr(ptr, '='); -+ if (str == NULL || str >= ptr2) - return -1; // Malformed - bomb out -+ - // name is 1 past - str++; - return audit_name_to_msg_type(str); -diff --git a/src/ausearch-lol.c b/src/ausearch-lol.c -index 29d0a32..3a2e5e8 100644 ---- a/src/ausearch-lol.c -+++ b/src/ausearch-lol.c -@@ -135,10 +135,12 @@ static int extract_timestamp(const char *b, event *e) - char *ptr, *tmp, *tnode, *ttype; - - e->node = NULL; -+ -+ tmp = alloca(340); - if (*b == 'n') -- tmp = strndupa(b, 340); -+ tmp = strncpy(tmp, b, 340); - else -- tmp = strndupa(b, 80); -+ tmp = strncpy(tmp, b, 80); - ptr = audit_strsplit(tmp); - if (ptr) { - // Check to see if this is the node info --- -2.13.1 - |