openwrt-pf/package/system
Anna Kiri df26b8723a
mtd: jffs2: add missing malloc NULL check
In mtd_replace_jffs2(), the return value of malloc(erasesize) is never
checked. If the allocation fails, buf remains NULL and the subsequent
memcpy(buf + ofs, ...) in add_data() will dereference NULL, causing a
segfault.

Add a NULL check and return -1 on allocation failure. Match the
diagnostic message used by the sibling mtd_write_jffs2() so the
out-of-memory cause is visible at the call site.

Signed-off-by: Anna Kiri <bredcorn@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/23553
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
2026-05-31 23:57:14 +02:00
..
apk apk: add help text for 'apk add --force-reinstall' 2026-03-16 14:52:56 +01:00
ca-certificates ca-certificates: update to 20260223 2026-04-30 00:17:59 +02:00
fstools fstools: update to Git HEAD (2026-05-23) 2026-05-23 18:25:00 +02:00
fwtool
gpio-cdev/nu801
iucode-tool
mtd mtd: jffs2: add missing malloc NULL check 2026-05-31 23:57:14 +02:00
openwrt-keyring openwrt-keyring: update to Git HEAD (2025-12-10) 2025-12-10 23:22:27 +01:00
opkg
procd procd: update to Git HEAD (2026-03-25) 2026-04-13 11:55:37 +09:00
refpolicy refpolicy: update to 2.20260312 2026-04-27 10:50:54 +02:00
rpcd rpcd: update to Git HEAD (2025-12-03) 2025-12-04 11:06:48 +01:00
selinux-policy selinux-policy: update to 2.8.4 2025-11-27 13:32:52 +01:00
ubox ubox: update to Git HEAD (2025-10-30) 2025-11-11 00:20:14 +01:00
ubus ubus: update to Git HEAD (2026-05-23) 2026-05-23 19:32:01 +02:00
ucert treewide: add explicit default variant 2026-01-02 14:46:30 +01:00
uci uci: update to Git HEAD (2025-12-02) 2025-12-09 20:36:25 +01:00
urandom-seed
urngd
usign
zram-swap