fscanf can occur buffer overflow issue.
Thus the function is changed to fgets.
Change-Id: Icd8713effc71245bf2ee61ce5e2129c285b0a2c3
Signed-off-by: taeyoung <ty317.kim@samsung.com>
FILE *fp;
storage_ext_device *dev;
char file_name[PATH_LEN];
+ char *tmp;
int ret = 0;
if (storage_id < 0)
goto out;
}
- ret = fscanf(fp, "%s", path);
- if (ret <= 0) {
+ tmp = fgets(path, len, fp);
+ fclose(fp);
+ if (!tmp) {
ret = -ENODEV;
_D("Failed to get path");
- fclose(fp);
goto out;
}
- fclose(fp);
+
} else {
dev = calloc(1, sizeof(storage_ext_device));
if (!dev) {