mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-30 22:05:27 +00:00
- Using asprintf instead of snprintf
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
Name: libapparmor1
|
||||
Version: 2.1
|
||||
Release: 1
|
||||
Release: 2
|
||||
License: LGPL
|
||||
Group: Development/Libraries/C and C++
|
||||
BuildRoot: %{_tmppath}/%{name}-${version}-build
|
||||
|
@@ -307,13 +307,7 @@ old_profile:
|
||||
|
||||
audit_msg: TOK_KEY_MSG TOK_EQUALS TOK_AUDIT TOK_OPEN_PAREN TOK_AUDIT_DIGITS TOK_PERIOD TOK_AUDIT_DIGITS TOK_COLON TOK_AUDIT_DIGITS TOK_CLOSE_PAREN TOK_COLON
|
||||
{
|
||||
/* TOK_AUDIT_DIGITS is actually a character string, and this could be done in a better way. */
|
||||
int len1 = strlen($5);
|
||||
int len2 = strlen($7);
|
||||
int len3 = strlen($9);
|
||||
int len = len1 + len2 + len3;
|
||||
ret_record->audit_id = (char *) malloc(len + 4);
|
||||
snprintf(ret_record->audit_id, len + 3, "%s.%s:%s", $5, $7, $9);
|
||||
asprintf(&ret_record->audit_id, "%s.%s:%s", $5, $7, $9);
|
||||
free($5);
|
||||
free($7);
|
||||
free($9);
|
||||
|
Reference in New Issue
Block a user