2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 06:16:03 +00:00

libapparmor: Perform strlen() test before indexing into the string

It looks odd to access the first character of a string before checking
to see if the string's length is zero. This is actually fine, in
practice, since strlen() looks at the first character of the string for
the presence of '\0' which means this is entirely a cosmetic change.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
This commit is contained in:
Tyler Hicks
2015-06-15 23:58:29 -05:00
parent 994eb7e3b9
commit 3e80c75f57

View File

@@ -113,7 +113,7 @@ int _aa_is_blacklisted(const char *name, const char *path)
struct ignored_suffix_t *suffix;
/* skip dot files and files with no name */
if (*name == '.' || !strlen(name))
if (!strlen(name) || *name == '.')
return 1;
name_len = strlen(name);