{
char str[128];
FILE *file;
+ int res;
/* Check that this is a zoned block device */
snprintf(str, sizeof(str),
goto not_zoned;
memset(str, 0, sizeof(str));
- fscanf(file, "%s", str);
+ res = fscanf(file, "%s", str);
fclose(file);
+ if (res != 1)
+ goto not_zoned;
+
if (strcmp(str, "host-aware") == 0) {
c.zoned_model = F2FS_ZONED_HA;
return;
uint64_t sectors;
char str[128];
FILE *file;
+ int res;
/* Get zone size */
c.zone_blocks = 0;
return -1;
memset(str, 0, sizeof(str));
- fscanf(file, "%s", str);
+ res = fscanf(file, "%s", str);
fclose(file);
+ if (res != 1)
+ return -1;
+
sectors = atol(str);
if (!sectors)
return -1;