[PATCH 4/9] gdhcp: Only write terminating NUL once at end of string

Patrik Flykt patrik.flykt at linux.intel.com
Thu Sep 12 06:30:45 PDT 2013


	Hi,

On Tue, 2013-09-10 at 15:46 +0200, Peter Meerwald wrote:
> ---
>  gdhcp/client.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/gdhcp/client.c b/gdhcp/client.c
> index e6106d1..a3a4475 100644
> --- a/gdhcp/client.c
> +++ b/gdhcp/client.c
> @@ -1830,8 +1830,8 @@ static char *malloc_option_value_string(uint8_t *option, GDHCPOptionType type)
>  		if (len <= 0)
>  			break;
>  		*dest++ = ' ';
> -		*dest = '\0';
>  	}
> +	*dest = '\0';
>  
>  	return ret;
>  }

The logic in this patch is ok. Unfortunately the remaining length should
be checked before writing to 'dest', so there is more to fix in the
function. It's fine you want to bite into this and get it fixed tool.

Cheers,

	Patrik




More information about the connman mailing list