Guard for block device name string starting with "/dev/"

This commit is contained in:
Imbus 2026-02-07 13:51:16 +01:00
parent cf85ca788a
commit 88a1a87ca6

View file

@ -194,6 +194,11 @@ int main(int argc, char *argv[]) {
exit(EXIT_FAILURE);
}
if (0 != strncmp(wjob.dev_name, "/dev/", 4)) {
printf("\"%s\" does not appear to be a block device...\n", wjob.dev_name);
exit(EXIT_FAILURE);
}
printf("Writing %s to %s\n", wjob.filename, wjob.dev_name);
wjob.buffer = malloc(BLOCKSIZE);