65 lines
1.5 KiB
Diff
65 lines
1.5 KiB
Diff
|
diff --git a/auparse/auparse.c b/auparse/auparse.c
|
||
|
index 20ebe4f8..ab3d3189 100644
|
||
|
--- a/auparse/auparse.c
|
||
|
+++ b/auparse/auparse.c
|
||
|
@@ -1224,12 +1224,23 @@ static int extract_timestamp(const char *b, au_event_t *e)
|
||
|
{
|
||
|
char *ptr, *tmp;
|
||
|
int rc = 1;
|
||
|
+ size_t len;
|
||
|
|
||
|
e->host = NULL;
|
||
|
- if (*b == 'n')
|
||
|
- tmp = strndupa(b, 340);
|
||
|
- else
|
||
|
- tmp = strndupa(b, 80);
|
||
|
+ if (*b == 'n') {
|
||
|
+ /* tmp = strndupa(b, 340); */
|
||
|
+ len = strnlen(b, 340);
|
||
|
+ tmp = alloca(len + 1);
|
||
|
+ tmp[len] = 0;
|
||
|
+ memcpy(tmp, b, len);
|
||
|
+ }
|
||
|
+ else {
|
||
|
+ /* tmp = strndupa(b, 80); */
|
||
|
+ len = strnlen(b, 80);
|
||
|
+ tmp = alloca(len + 1);
|
||
|
+ tmp[len] = 0;
|
||
|
+ memcpy(tmp, b, len);
|
||
|
+ }
|
||
|
ptr = audit_strsplit(tmp);
|
||
|
if (ptr) {
|
||
|
// Optionally grab the node - may or may not be included
|
||
|
diff --git a/src/ausearch-lol.c b/src/ausearch-lol.c
|
||
|
index 9893afb0..4695817e 100644
|
||
|
--- a/src/ausearch-lol.c
|
||
|
+++ b/src/ausearch-lol.c
|
||
|
@@ -178,12 +178,23 @@ static inline char *strndupa(const char *old, size_t n)
|
||
|
static int extract_timestamp(const char *b, event *e)
|
||
|
{
|
||
|
char *ptr, *tmp, *tnode, *ttype;
|
||
|
+ size_t len;
|
||
|
|
||
|
e->node = NULL;
|
||
|
- if (*b == 'n')
|
||
|
- tmp = strndupa(b, 340);
|
||
|
- else
|
||
|
- tmp = strndupa(b, 80);
|
||
|
+ if (*b == 'n') {
|
||
|
+ /* tmp = strndupa(b, 340); */
|
||
|
+ len = strnlen(b, 340);
|
||
|
+ tmp = alloca(len + 1);
|
||
|
+ tmp[len] = 0;
|
||
|
+ memcpy(tmp, b, len);
|
||
|
+ }
|
||
|
+ else {
|
||
|
+ /* tmp = strndupa(b, 80); */
|
||
|
+ len = strnlen(b, 80);
|
||
|
+ tmp = alloca(len + 1);
|
||
|
+ tmp[len] = 0;
|
||
|
+ memcpy(tmp, b, len);
|
||
|
+ }
|
||
|
ptr = audit_strsplit(tmp);
|
||
|
if (ptr) {
|
||
|
// Check to see if this is the node info
|