summaryrefslogtreecommitdiff
path: root/src/profile.c
diff options
context:
space:
mode:
authorGrant Erickson <marathon96@gmail.com>2011-03-02 17:24:32 +0100
committerSamuel Ortiz <sameo@linux.intel.com>2011-03-02 17:25:20 +0100
commit672a33a8a96cc0f8dadadd442cb066bcc84be519 (patch)
treebedfe266653c0b47d117c614193f4b15b87a84d8 /src/profile.c
parentbbbb938cb28a11fa6b794c476bd13a486668e33b (diff)
downloadconnman-672a33a8a96cc0f8dadadd442cb066bcc84be519.tar.gz
connman-672a33a8a96cc0f8dadadd442cb066bcc84be519.tar.bz2
connman-672a33a8a96cc0f8dadadd442cb066bcc84be519.zip
profile: Ignore malformed profiles
Ignore malformed profiles. That is, if there is no non-extension portion to the file (i.e. it is precisely named .profile), then ignore it. Passing such files to create_profile will result in a SIGABRT.
Diffstat (limited to 'src/profile.c')
-rw-r--r--src/profile.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/profile.c b/src/profile.c
index 3018fdc1..e6a397b0 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -462,6 +462,19 @@ static int profile_init(void)
if (ident == NULL)
continue;
+ /*
+ * If there is no non-extension portion to the file
+ * (i.e. it is precisely named ".profile"), then ignore
+ * it. Passing such files to create_profile will result
+ * in a SIGABRT.
+ */
+
+ if (file == ident) {
+ connman_info("Ignoring malformed profile %s\n",
+ file);
+ continue;
+ }
+
str = g_string_new_len(file, ident - file);
if (str == NULL)
continue;