-
Notifications
You must be signed in to change notification settings - Fork 3.2k
string from file function for bad usb #4231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
| UNUSED(param); | ||
| char buffer[254]; | ||
| size_t read_bytes; | ||
| Storage* storage = furi_record_open("storage"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RECORD_STORAGE
hedger
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please address the comments
| char buffer[254]; | ||
| size_t read_bytes; | ||
| Storage* storage = furi_record_open("storage"); | ||
| File* file = storage_file_alloc(storage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
file is leaked - never freed
|
|
||
| line = &line[ducky_get_command_len(line) + 1]; | ||
| if (file) { | ||
| storage_file_open(file, line, FSAM_READ, FSOM_OPEN_EXISTING); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing check if open was successful
|
|
||
| static int32_t ducky_fnc_string_from_file(BadUsbScript* bad_usb, const char* line, int32_t param) { | ||
| UNUSED(param); | ||
| char buffer[254]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works as a hard limit for file size - I think it should either be documented and checked or much higher
|
Please un-draft when fixed |
What's new
A badusb function to take the content of a file and print it.
/ext/abc.txtVerification
Here is a sample script to test the function:
make sure to place a file named
abc.txtat the root of an sdcard with text inside of it.Checklist (For Reviewer)