buglwIP - A Lightweight TCP/IP stack - Bugs: bug #65732, Infinity "for" loop in...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #65732: Infinity "for" loop in mkfsdata.c

Submitter:  Alexey <spider_vc>
Submitted:  Mon 13 May 2024 10:30:47 AM UTC
   
 
Category:  apps Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Planned Release:  None
lwIP version:  git head

Mon 13 May 2024 10:30:47 AM UTC, original submission:  

in file:
src/apps/http/makefsdata/makefsdata.c:728

  src_offset = 0;
  for (offset = hdr_len; ; offset += len) {
    unsigned short chksum;
    const void *data = (const void *)&file_data[src_offset];
    len = LWIP_MIN(chunk_size, (int)file_size - src_offset);
    if (len == 0) {
      break;
    }
    chksum = ~inet_chksum(data, (u16_t)len);
    /* add checksum for data */
    fprintf(struct_file, "{%d, 0x%04x, %"SZT_F"}," NEWLINE, offset, chksum, len);
    i++;
  }


loop condition is wrong. src_offset never changed and as result len never reach zero.

I think right condition will be like that:

   for (offset = hdr_len; ; src_offset += len) {


8 years old BUG....

Alexey <spider_vc>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by spider_vc (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-6ae7.
    Corresponding source code