Rebase Cradlepoint changes over busybox v1.36.0
Fixed rejects in the following files:
./include/libbb.h
./libbb/verror_msg.c
./networking/udhcp/common.c
./sysklogd/syslogd.c
./Makefile
./networking/udhcp/dhcpc.c
Fixed the data structure names to the latest (client_config in dhcpc.c)
Fixed the compiler warning for local address (filename2modname in modutils.c)
Fixed the redefined functions (bb_info_msg)
Change-Id: Ib1f9b28212476f974f20b16c7a393aaf0158f64a
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c
index b616516..e3f4f09 100644
--- a/modutils/modprobe-small.c
+++ b/modutils/modprobe-small.c
@@ -484,7 +484,8 @@
if (is_depmod && (option_mask32 & DEPMOD_OPT_n))
return STDOUT_FILENO;
- fd = open(DEPFILE_BB".new", O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0644);
+ /* Cradlepoint (CP) changed the mode 0644 => 0600 */
+ fd = open(DEPFILE_BB".new", O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600);
if (fd < 0) {
if (errno == EEXIST) {
int count = 5 * 20;
@@ -499,7 +500,8 @@
break;
}
bb_error_msg("deleting stale %s", DEPFILE_BB".new");
- fd = open_or_warn(DEPFILE_BB".new", O_WRONLY | O_CREAT | O_TRUNC);
+ /* Cradlepoint (CP) open => open3 with 0600 */
+ fd = open3_or_warn(DEPFILE_BB".new", O_WRONLY | O_CREAT | O_TRUNC, 0600);
}
}
dbg1_error_msg("opened "DEPFILE_BB".new:%d", fd);
@@ -515,9 +517,14 @@
fp = xfdopen_for_write(fd);
i = 0;
while (modinfo[i].pathname) {
+ /* Cradlepoint (CP) fix null pointer deref in fprint args */
fprintf(fp, "%s%s%s\n" "%s%s\n",
- modinfo[i].pathname, modinfo[i].aliases[0] ? " " : "", modinfo[i].aliases,
- modinfo[i].deps, modinfo[i].deps[0] ? "\n" : "");
+ modinfo[i].pathname,
+ modinfo[i].aliases && modinfo[i].aliases[0] ? " " : "",
+ modinfo[i].aliases ? modinfo[i].aliases : "",
+
+ modinfo[i].deps ? modinfo[i].deps : "",
+ modinfo[i].deps && modinfo[i].deps[0] ? "\n" : "");
i++;
}
/* Badly formatted depfile is a no-no. Be paranoid. */
diff --git a/modutils/modutils.c b/modutils/modutils.c
index f7ad5e8..2006c39 100644
--- a/modutils/modutils.c
+++ b/modutils/modutils.c
@@ -98,7 +98,8 @@
if (filename == NULL)
return NULL;
if (modname == NULL)
- modname = local_modname;
+ return NULL;
+ // modname = local_modname;
// Disabled since otherwise "modprobe dir/name" would work
// as if it is "modprobe name". It is unclear why
// 'basenamization' was here in the first place.