bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 3/4] ddb: safely copy symbol names into the symtab structure


From: Samuel Thibault
Subject: Re: [PATCH 3/4] ddb: safely copy symbol names into the symtab structure
Date: Tue, 4 Feb 2014 13:46:30 +0100
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Justus Winter, le Tue 04 Feb 2014 11:50:03 +0100, a écrit :
> Use strncpy instead of strcpy to copy the name of a symbol into the
> symtab structure.  Make sure that the string is properly terminated.
> 
> Found using Coverity.
> 
> * ddb/db_sym.c (db_add_symbol_table): Use strncpy instead of strcpy,
> ensure string termination.

Ack.

> ---
>  ddb/db_sym.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/ddb/db_sym.c b/ddb/db_sym.c
> index beb4d18..3c8caf4 100644
> --- a/ddb/db_sym.c
> +++ b/ddb/db_sym.c
> @@ -75,7 +75,8 @@ db_add_symbol_table(type, start, end, name, ref, 
> map_pointer)
>       st->end = end;
>       st->private = ref;
>       st->map_pointer = (map_pointer == (char *)kernel_map)? 0: map_pointer;
> -     strcpy(st->name, name);
> +     strncpy(st->name, name, sizeof st->name - 1);
> +     st->name[sizeof st->name - 1] = '\0';
>  
>       db_nsymtab++;
>  
> -- 
> 1.8.5.2
> 

-- 
Samuel
 > Subject: pb fvwm95-2 comment l'installer le compiler???
 > Merci d'avance
 je te conseille d'être un peu plus précis dans l'exposé de ton pb...
 -+- EJ in guide du linuxien pervers :"Les modéros sont sympas !" -+-



reply via email to

[Prev in Thread] Current Thread [Next in Thread]