Add code to check symlink before open file handle.
(fix one of security issues)
Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
/* Search and register if found with the conf */
const gchar *fullpath = nnsconf_get_fullpath (name, type);
- if (fullpath == NULL)
+ /**
+ * @todo Consider to add option to open symbolic link file and version-specified library name.
+ */
+ if (fullpath == NULL || g_file_test (fullpath, G_FILE_TEST_IS_SYMLINK))
goto error; /* No Such Thing !!! */
G_UNLOCK (splock);
return -1;
}
+ /**
+ * @todo Consider to add option to open symbolic link file and version-specified library name.
+ */
+ if (g_file_test (prop->model_file, G_FILE_TEST_IS_SYMLINK)) {
+ /* symbolic link */
+ return -1;
+ }
+
ptr = g_new0 (internal_data, 1); /* Fill Zero! */
*private_data = ptr;