Magisk/native
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
..
jni Prevent setting zero over than bound 2018-06-19 14:22:11 -07:00
src/main Rename module core to native 2018-01-27 09:11:28 +08:00
.gitignore Rename module core to native 2018-01-27 09:11:28 +08:00
build.gradle Use lower API level for static binaries 2018-05-13 05:22:46 +08:00