Bug in "subscriber ... name", if name contains spaces

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Harald Welte laforge at gnumonks.org
Thu Jun 24 06:07:52 UTC 2010


Dear Luca,

thanks for your patch.

> I found a bug in OpenBSC. If I try to change the name of a subscriber
> using Telnet (command "subscriber ... name") I got an error, if the
> name contains spaces (for example: first and lastname).
> 
> I found the problem and I wrote a patches.

I have appllied your patch but found some problem (whcih I already
fixed):
>  	struct gsm_network *gsmnet = gsmnet_from_vty(vty);
>  	struct gsm_subscriber *subscr =
>  			get_subscr_by_argv(gsmnet, argv[0], argv[1]);
> -	const char *name = argv[2];
> +	char *name;
> +
> +	name = argv_concat(argv, argc, 2);

we never check if name is NULL here

>  	if (!subscr) {
>  		vty_out(vty, "%% No subscriber found for %s %s%s",
> @@ -410,6 +412,7 @@ DEFUN(ena_subscr_name,
>  	}
>  
>  	strncpy(subscr->name, name, sizeof(subscr->name));
> +	talloc_free(name);

we only free it in case subscr != NULL.  If subscr == NULL,
the function has already returned before we get to this free,
causing a memory leak.

I have now re-ordered the function slightly to fix this problem (9d4cca7)

-- 
- Harald Welte <laforge at gnumonks.org>           http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
                                                  (ETSI EN 300 175-7 Ch. A6)




More information about the OpenBSC mailing list