Re: [PATCH] sim: m32c/rl78/rx: fix command parsing

Tom Tromey
2021-05-05T19:13:57Z

>>>>> "Mike" == Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org> writes:

Mike> Use buildargv to avoid writing to const memory and freeing invalid
Mike> pointers, and to avoid doing any string parsing ourselves.

Thank you.

Mike> + char **argv = buildargv (cmd);

Mike> + cmd = argv[0];
Mike> + arg = argv[1];

I think this should also check that argv[0] and argv[1] != NULL somewhere.
Otherwise malformed commands like "monitor" or "monitor trace" may crash.

Tom