mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
parser: remove static sized buffer in process_dbus_entry()
This patch converts a stack allocated buffer into an std::ostringstream object. The stringstream interface for specifying the equivalent of a printf %02x conversion is a bit of an awkward construction, however. Signed-off-by: Steve Beattie <steve@nxnw.org> Acked-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
parent
5f18a7c237
commit
6e701f798f
1 changed files with 6 additions and 3 deletions
|
@ -24,7 +24,10 @@
|
|||
#include <sys/apparmor.h>
|
||||
#define _(s) gettext(s)
|
||||
|
||||
#include <iomanip>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
/* #define DEBUG */
|
||||
|
||||
|
@ -1015,7 +1018,7 @@ static int process_dbus_entry(aare_ruleset_t *dfarules, struct dbus_entry *entry
|
|||
std::string pathbuf;
|
||||
std::string ifacebuf;
|
||||
std::string memberbuf;
|
||||
char buffer[128];
|
||||
std::ostringstream buffer;
|
||||
const char *vec[6];
|
||||
|
||||
pattern_t ptype;
|
||||
|
@ -1024,8 +1027,8 @@ static int process_dbus_entry(aare_ruleset_t *dfarules, struct dbus_entry *entry
|
|||
if (!entry) /* shouldn't happen */
|
||||
return TRUE;
|
||||
|
||||
sprintf(buffer, "\\x%02x", AA_CLASS_DBUS);
|
||||
busbuf.append(buffer);
|
||||
buffer << "\\x" << std::setfill('0') << std::setw(2) << std::hex << AA_CLASS_DBUS;
|
||||
busbuf.append(buffer.str());
|
||||
|
||||
if (entry->bus) {
|
||||
ptype = convert_aaregex_to_pcre(entry->bus, 0, busbuf, &pos);
|
||||
|
|
Loading…
Add table
Reference in a new issue