mirror of
https://git.sr.ht/~cismonx/bookmarkfs
synced 2025-06-07 19:58:50 +00:00
ioctl: check if permd op is valid
A bad permd op should fail ioctl() with EINVAL instead of invoking undefined behavior.
This commit is contained in:
parent
486bd6b36e
commit
3e325a3934
2 changed files with 5 additions and 1 deletions
|
@ -2444,7 +2444,7 @@ bookmark_permute (
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
unreachable();
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
ctx->dirty = DIRTY_LEVEL_DATA;
|
ctx->dirty = DIRTY_LEVEL_DATA;
|
||||||
|
|
||||||
|
|
|
@ -926,6 +926,8 @@ mozbm_pos_shift (
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*pos_end_ptr = pos_end;
|
*pos_end_ptr = pos_end;
|
||||||
|
} else if (op != BOOKMARKFS_PERMD_OP_MOVE_AFTER) {
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
++pos_start;
|
++pos_start;
|
||||||
} else {
|
} else {
|
||||||
|
@ -934,6 +936,8 @@ mozbm_pos_shift (
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*pos_end_ptr = pos_end;
|
*pos_end_ptr = pos_end;
|
||||||
|
} else if (op != BOOKMARKFS_PERMD_OP_MOVE_BEFORE) {
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
--pos_start;
|
--pos_start;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue