Magisk/native/jni/core
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
..
bootstages.c Fix adbd on GSIs 2018-06-17 01:25:27 +08:00
daemon.c Remove invincible mode 2018-06-17 01:28:29 +08:00
db.c Install stub APK when needed 2018-06-14 05:09:54 +08:00
log_monitor.c Preserve last log 2018-06-17 01:38:58 +08:00
magisk.c Change to applet name to prevent showing magisk.bin 2018-06-17 01:47:55 +08:00
magiskinit.c Prevent setting zero over than bound 2018-06-19 14:22:11 -07:00
socket.c Massive sepolicy refactor 2018-04-15 03:18:18 +08:00