mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-30 22:05:27 +00:00
Add new processid fn that handles both quoted and unquoted ids
There is a lot of duplication of code calling processqunquoted and processquoted. Move all this code to use the new processid fn. Signed-off-by: John Johansen <john.johansen@canonical.com> Acked-by: Kees Cook <kees@ubuntu.com>
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
/* assistance routines */
|
||||
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -397,6 +398,16 @@ char *processunquoted(char *string, int len)
|
||||
return tmp;
|
||||
}
|
||||
|
||||
char *processid(char *string, int len)
|
||||
{
|
||||
/* lexer should never call this fn if len <= 0 */
|
||||
assert(len > 0);
|
||||
|
||||
if (*string == '"')
|
||||
return processquoted(string, len);
|
||||
return processunquoted(string, len);
|
||||
}
|
||||
|
||||
/* rewrite a quoted string substituting escaped characters for the
|
||||
* real thing. Strip the quotes around the string */
|
||||
|
||||
|
Reference in New Issue
Block a user