Add __attribute__((format(printf, a, b))) to printf like functions.
Fix potential string format bug. Change-Id: Ie05aac53b2c45a48bd68e340b76ccb21edfd28b7
This commit is contained in:
@@ -31,7 +31,7 @@ void ui_clear_key_queue();
|
|||||||
// Write a message to the on-screen log shown with Alt-L (also to stderr).
|
// Write a message to the on-screen log shown with Alt-L (also to stderr).
|
||||||
// The screen is small, and users may need to report these messages to support,
|
// The screen is small, and users may need to report these messages to support,
|
||||||
// so keep the output short and not too cryptic.
|
// so keep the output short and not too cryptic.
|
||||||
void ui_print(const char *fmt, ...);
|
void ui_print(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
|
||||||
|
|
||||||
// Display some header text followed by a menu of items, which appears
|
// Display some header text followed by a menu of items, which appears
|
||||||
// at the top of the screen (in place of any scrolling ui_print()
|
// at the top of the screen (in place of any scrolling ui_print()
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ try_update_binary(const char *path, ZipArchive *zip) {
|
|||||||
} else if (strcmp(command, "ui_print") == 0) {
|
} else if (strcmp(command, "ui_print") == 0) {
|
||||||
char* str = strtok(NULL, "\n");
|
char* str = strtok(NULL, "\n");
|
||||||
if (str) {
|
if (str) {
|
||||||
ui_print(str);
|
ui_print("%s", str);
|
||||||
} else {
|
} else {
|
||||||
ui_print("\n");
|
ui_print("\n");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user