Maks Mishin <[email protected]> 於 2024年8月19日 星期一寫道:
> The function clean_up_cur_rule() calls in the loop, which can lead to
> double-free of pointers `G.cur_rule.envvar` and `G.cur_rule.ren_mov`.
> Added NULL checks and NULL assignment after free for correct checks.
>
> - free(G.cur_rule.envvar);
> - free(G.cur_rule.ren_mov);
> + if (G.cur_rule.envvar != NULL) {
> + free(G.cur_rule.envvar);
> + G.cur_rule.envvar = NULL;
> + }
> + if (G.cur_rule.ren_mov != NULL) {
> + free(G.cur_rule.ren_mov);
> + G.cur_rule.ren_mov = NULL;
> + }
> +
libc free() function should do no-op if the argument is NULL. Thus the
check for NULL conditionals may be removed.
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox