Suspicious code
    Jef Driesen 
    jefdriesen at telenet.be
       
    Tue Dec  6 08:01:07 UTC 2011
    
    
  
On Mon, 05 Dec 2011 10:14:08 -0500, Steve Boyd <sboydlns at gmail.com> wrote:
> When building with Visual Studio I got a warning in zeagle_n2ition3.c.  
> The following code looks a bit suspicious to me.
> 
> static device_status_t
> zeagle_n2ition3_init (zeagle_n2ition3_device_t *device)
> {
>      unsigned char answer[6 + 13] = {0};
>      unsigned char command[6] = {0x02, 0x01, 0x00, 0x41, 0xBF, 0x03};
>      command[11] = ~checksum_add_uint8 (command + 3, 8, 0x00) + 1;
> 
>      return zeagle_n2ition3_packet (device, command, sizeof (command), 
> answer, sizeof (answer));
> }
> 
> You are setting command[11] to a value when there are only 6 elements in
> command.
This bug has already been fixed quite some time ago, so you are probably
looking at outdated code.
PS: Try to use plaintext instead of html when sending to the mailinglist.
    
    
More information about the Devel
mailing list