aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/audit.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/audit.c')
-rw-r--r--kernel/audit.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/audit.c b/kernel/audit.c
index bf74bf02aa4b..d09f131b111a 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1026,18 +1026,20 @@ void audit_log_hex(struct audit_buffer *ab, const unsigned char *buf,
1026 * or a space. Unescaped strings will start and end with a double quote mark. 1026 * or a space. Unescaped strings will start and end with a double quote mark.
1027 * Strings that are escaped are printed in hex (2 digits per char). 1027 * Strings that are escaped are printed in hex (2 digits per char).
1028 */ 1028 */
1029void audit_log_untrustedstring(struct audit_buffer *ab, const char *string) 1029const char *audit_log_untrustedstring(struct audit_buffer *ab, const char *string)
1030{ 1030{
1031 const unsigned char *p = string; 1031 const unsigned char *p = string;
1032 size_t len = strlen(string);
1032 1033
1033 while (*p) { 1034 while (*p) {
1034 if (*p == '"' || *p < 0x21 || *p > 0x7f) { 1035 if (*p == '"' || *p < 0x21 || *p > 0x7f) {
1035 audit_log_hex(ab, string, strlen(string)); 1036 audit_log_hex(ab, string, len);
1036 return; 1037 return string + len + 1;
1037 } 1038 }
1038 p++; 1039 p++;
1039 } 1040 }
1040 audit_log_format(ab, "\"%s\"", string); 1041 audit_log_format(ab, "\"%s\"", string);
1042 return p + 1;
1041} 1043}
1042 1044
1043/* This is a helper-function to print the escaped d_path */ 1045/* This is a helper-function to print the escaped d_path */