[PATCH] miscutils/microcom: Fixed segfault

Tito farmatito at tiscali.it
Thu Aug 3 05:39:05 UTC 2017


Hi,
just a hint:

On 08/03/2017 07:11 AM, Marian Buschsieweke wrote:
> microcom did not check if required parameter TTY is present. Thus,
> bb_basename() was called with a NULL pointer if TTY was missing.
> This commit adds the missing check.
> ---
>   miscutils/microcom.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/miscutils/microcom.c b/miscutils/microcom.c
> index 14b9f3baf..38f6425c1 100644
> --- a/miscutils/microcom.c
> +++ b/miscutils/microcom.c
> @@ -78,6 +78,11 @@ int microcom_main(int argc UNUSED_PARAM, char **argv)
>   //	argc -= optind;
>   	argv += optind;
>   
> +	if (*argv == NULL){
> +		bb_show_usage();
bb_show_usage() exits with xfunc_error_retval
so this line is not reached and can be removed
> +		return EXIT_FAILURE;
> +	}
> +
>   	// try to create lock file in /var/lock
>   	device_lock_file = (char *)bb_basename(argv[0]);
>   	device_lock_file = xasprintf("/var/lock/LCK..%s", device_lock_file);
> 

ciao,
Tito


More information about the busybox mailing list