aboutsummaryrefslogtreecommitdiff
path: root/miscutils/ubirename.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-08-07 16:00:25 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-08-07 16:00:25 +0200
commit798b94518e61ced3f7be7766727705df4859878c (patch)
treeaf26ec7b4cb178933e6a76decb9561739933288d /miscutils/ubirename.c
parentb34eb4a591fa4dbbc091524a1c1159e2743134c8 (diff)
downloadbusybox-w32-798b94518e61ced3f7be7766727705df4859878c.tar.gz
busybox-w32-798b94518e61ced3f7be7766727705df4859878c.tar.bz2
busybox-w32-798b94518e61ced3f7be7766727705df4859878c.zip
ubi tools: ubiupdatevol supports "-" input and actually respects -s SIZE
Decided to not make any flash applets NOEXEC. Minor robustifications here and there. Better error messages. Save on strings: function old new delta ubi_tools_main 1235 1288 +53 ubi_get_volid_by_name 125 133 +8 ubirename_main 198 204 +6 get_num_from_file 90 94 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/0 up/down: 71/0) Total: 71 bytes text data bss dec hex filename 915696 485 6880 923061 e15b5 busybox_old 915670 485 6880 923035 e159b busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to '')
-rw-r--r--miscutils/ubirename.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/miscutils/ubirename.c b/miscutils/ubirename.c
index 786c4b9fa..ecc8fe137 100644
--- a/miscutils/ubirename.c
+++ b/miscutils/ubirename.c
@@ -14,6 +14,7 @@
14//config: Utility to rename UBI volumes 14//config: Utility to rename UBI volumes
15 15
16//applet:IF_UBIRENAME(APPLET(ubirename, BB_DIR_USR_SBIN, BB_SUID_DROP)) 16//applet:IF_UBIRENAME(APPLET(ubirename, BB_DIR_USR_SBIN, BB_SUID_DROP))
17/* not NOEXEC: if flash operation stalls, use less memory in "hung" process */
17 18
18//kbuild:lib-$(CONFIG_UBIRENAME) += ubirename.o 19//kbuild:lib-$(CONFIG_UBIRENAME) += ubirename.o
19 20
@@ -80,9 +81,12 @@ int ubirename_main(int argc, char **argv)
80 argv += 2; 81 argv += 2;
81 while (argv[0]) { 82 while (argv[0]) {
82 rnvol->ents[n].vol_id = ubi_get_volid_by_name(ubi_devnum, argv[0]); 83 rnvol->ents[n].vol_id = ubi_get_volid_by_name(ubi_devnum, argv[0]);
83 rnvol->ents[n].name_len = strlen(argv[1]); 84
85 /* strnlen avoids overflow of 16-bit field (paranoia) */
86 rnvol->ents[n].name_len = strnlen(argv[1], sizeof(rnvol->ents[n].name));
84 if (rnvol->ents[n].name_len >= sizeof(rnvol->ents[n].name)) 87 if (rnvol->ents[n].name_len >= sizeof(rnvol->ents[n].name))
85 bb_error_msg_and_die("new name '%s' is too long", argv[1]); 88 bb_error_msg_and_die("new name '%s' is too long", argv[1]);
89
86 strcpy(rnvol->ents[n].name, argv[1]); 90 strcpy(rnvol->ents[n].name, argv[1]);
87 n++; 91 n++;
88 argv += 2; 92 argv += 2;