[asterisk-dev] struct state_change

Philipp Kempgen philipp.kempgen at amooma.de
Wed Apr 4 19:29:13 MST 2007


Philipp Kempgen wrote:

> In main/devicestate.c there is
> 
> struct state_change {
> 	AST_LIST_ENTRY(state_change) list;
> 	char device[1];
> };
> 
> shouldn't that be
> 	char device[AST_MAX_EXTENSION];
> or something?
> 
> Because in main/devicestate.c in __ast_device_state_changed_literal
> there is a
> strcpy(change->device, device);

And shouldn't this be
strncpy(change->device, device, sizeof(change->device)-1);
or
ast_copy_string(change->device, device, sizeof(change->device));

> 
> which would copy something like "SIP/123456" to where is only room
> for the "S".

Regards,
  Philipp

-- 
amooma GmbH - Bachstr. 126 - 56566 Neuwied - http://www.amooma.de
     Let's use IT to solve problems and not to create new ones.
           Asterisk? -> http://www.das-asterisk-buch.de

Geschäftsführer: Stefan Wintermeyer
Handelsregister: Neuwied B 14998


More information about the asterisk-dev mailing list