Magisk/native/jni
npes87184 312466aaf8 Prevent setting zero over than bound
The &cmd will return a pointer which point to a pointer of cmdline.
It is a memory address which is usually 8 bytes in 64 bits machine.

However, the struct cmdline is 4 bytes. This will cause setting zero
beyond the bound.

Below is a simple example to show the differentiation:

struct cmdline {
        char skip_initramfs;
        char slot[3];
};

static void parse_cmdline(struct cmdline *cmd)
{
        printf("%lu\n", sizeof(*cmd)); /* 4 */
        printf("%lu\n", sizeof(&cmd)); /* 8 */
}

int main()
{
        struct cmdline cmd;
        parse_cmdline(&cmd);
        return 0;
}

This patch prevents this.

Signed-off-by: npes87184 <npes87184@gmail.com>
2018-06-19 14:22:11 -07:00
..
core Prevent setting zero over than bound 2018-06-19 14:22:11 -07:00
external Fix busybox issues 2018-06-09 15:45:56 +08:00
include Remove invincible mode 2018-06-17 01:28:29 +08:00
magiskboot magiskboot: Check dtb header content to avoid false positives 2018-06-10 03:02:13 +08:00
magiskhide Fix root loss issue when MagiskHide is enabled 2018-06-20 04:55:34 +08:00
magiskpolicy@c69dc0f036 Update sepolicy rules 2018-05-13 14:30:41 +08:00
resetprop Add Protobuf support to resetprop 2018-04-29 01:20:48 +08:00
su@29d5740205 Remove invincible mode 2018-06-17 01:28:29 +08:00
utils Simplify hiding conditions 2018-06-17 05:16:52 +08:00
Android.mk Bundle in stub APK into magiskinit 2018-06-14 02:54:38 +08:00
Application.mk Use lower API level for static binaries 2018-05-13 05:22:46 +08:00
b64xz.c Rename module core to native 2018-01-27 09:11:28 +08:00