D("received the \"%s\" signal\n", signal);
+ char cRealPath[PATH_MAX]= {0, };
booting_done = 1;
if (access(SDBD_BOOT_INFO_FILE, F_OK) == 0) {
I("booting is already done\n");
} else {
FILE *info_file = fopen(SDBD_BOOT_INFO_FILE, "w");
if (info_file != NULL) {
- fprintf(info_file, "%d", 1);
- fclose(info_file);
+ if (realpath(SDBD_BOOT_INFO_FILE, cRealPath) != NULL) {
+ if (strcmp(SDBD_BOOT_INFO_FILE, cRealPath) == 0) {
+ fprintf(info_file, "%d", 1);
+ I("booting is done\n");
+ } else {
+ D("Path has symbolic link, security risk \n");
+ return;
+ }
+ } else {
+ D("Getting realpath failed\n");
+ }
+ fclose(info_file);
}
- I("booting is done\n");
}
I("handled the booting done signal\n");