Bug 14551

Summary: hexedit-applet desperately needs a "readonly"-option
Product: Busybox Reporter: Guenther Brunthaler <gb_about_gnu>
Component: OtherAssignee: unassigned
Status: NEW ---    
Severity: enhancement CC: busybox-cvs
Priority: P5    
Version: 1.33.x   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

Description Guenther Brunthaler 2022-01-25 19:57:23 UTC
The "hexedit" BB applet is extremely useful for quickly examining boot sectors, partition tables and similar on-disk structures.

However, the current applet does not have a "readonly" option, and immediately writes any keyboard input to the disk.

This makes the usage of this applet extremely dangerous in practice: Accidentally pressing any key which corresponds to a hexadecimal character immediately damages the boot sector, superblock of a filesystem etc.

I therefore strongly recommend either adding a "-r" option to the applet for opening the target in read-only mode, or adding a second applet (like "hexbrowse") which shares the same code except for the mode argument to open().

Another option would be to cache the input in a buffer and only write it back after issuing a special local subcommand, such as pressing the F2 key in the original hexedit application.