profile: Ignore malformed profiles
authorGrant Erickson <marathon96@gmail.com>
Wed, 2 Mar 2011 16:24:32 +0000 (17:24 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Wed, 2 Mar 2011 16:25:20 +0000 (17:25 +0100)
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.

src/profile.c

index 3018fdc..e6a397b 100644 (file)
@@ -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;