We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a439970 commit 6d68884Copy full SHA for 6d68884
audisp/test/test-queue.c
@@ -22,10 +22,8 @@ static event_t *make_event(const char *str)
22
e->hdr.ver = AUDISP_PROTOCOL_VER;
23
e->hdr.hlen = sizeof(struct audit_dispatcher_header);
24
e->hdr.type = 0;
25
- e->hdr.size = strlen(str);
26
- if (e->hdr.size >= MAX_AUDIT_MESSAGE_LENGTH)
27
- e->hdr.size = MAX_AUDIT_MESSAGE_LENGTH - 1;
28
- strncpy(e->data, str, e->hdr.size);
+ e->hdr.size = strnlen(str, MAX_AUDIT_MESSAGE_LENGTH - 1);
+ memcpy(e->data, str, e->hdr.size);
29
e->data[e->hdr.size] = '\0';
30
return e;
31
}
0 commit comments