Commit 08bcd73
committed
exec_am_broadcast: fix NULL assignment of last element of child_argv
child_argv[argc+extra_args] is outside the allocated memory region,
since it starts counting from 0.
Seen with valgrind:
==22732== Invalid write of size 8
==22732== at 0x5E876D4: exec_am_broadcast (termux-api.c:254)
==22732== Address 0x6033e10 is 0 bytes after a block of size 144 alloc'd
==22732== at 0x5CC9FB4: malloc (in /data/data/com.termux/files/usr/libexec/valgrind/vgpreload_memcheck-arm64-linux.so)
==22732== by 0x5E875BF: exec_am_broadcast (termux-api.c:231)
==22732==
==22732== Syscall param execve(argv) points to uninitialised byte(s)
==22732== at 0x5FEEB78: execve (in /apex/com.android.runtime/lib64/bionic/libc.so)
==22732== by 0x5F18023: execve (in /data/data/com.termux/files/usr/lib/libtermux-exec.so)
==22732== Address 0x6033e08 is 136 bytes inside a block of size 144 alloc'd
==22732== at 0x5CC9FB4: malloc (in /data/data/com.termux/files/usr/libexec/valgrind/vgpreload_memcheck-arm64-linux.so)
==22732== by 0x5E875BF: exec_am_broadcast (termux-api.c:231)
==22732== Uninitialised value was created by a heap allocation
==22732== at 0x5CC9FB4: malloc (in /data/data/com.termux/files/usr/libexec/valgrind/vgpreload_memcheck-arm64-linux.so)
==22732== by 0x5E875BF: exec_am_broadcast (termux-api.c:231)1 parent eaf966b commit 08bcd73
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
248 | | - | |
| 248 | + | |
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
| |||
0 commit comments