buglwIP - A Lightweight TCP/IP stack - Bugs: bug #63929, ip6_frag.c: suspicious usage of...

 
 

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

bug #63929: ip6_frag.c: suspicious usage of 'sizeof(A*)'; pointer to aggregate

Submitter:  Jarno Malmari <jmalmari>
Submitted:  Wed 15 Mar 2023 09:24:39 AM UTC
   
 
Category:  IPv6 Severity:  3 - Normal
Item Group:  Compiler Warning Status:  Fixed
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned Release:  2.2.1
lwIP version:  git head

Tue 03 Oct 2023 03:51:06 PM UTC, comment #1: 

Fixed, thanks for reporting!

Simon Goldschmidt <goldsimon>
Group administrator
Wed 15 Mar 2023 09:24:39 AM UTC, original submission:  

clang-tidy found this potential issue. Can someone confirm if the sizeof argument is intentional? In the following snippet, I am talking about the last line with sizeof(iprh).


  struct ip6_reass_helper *iprh;

#if LWIP_ICMP6
  iprh = (struct ip6_reass_helper *)ipr->p->payload;
  if (iprh->start == 0) {
    /* The first fragment was received, send ICMP time exceeded. */
    /* First, de-queue the first pbuf from r->p. */
    p = ipr->p;
    ipr->p = iprh->next_pbuf;
    /* Restore the part that we've overwritten with our helper structure, or we
     * might send garbage (and disclose a pointer) in the ICMPv6 reply. */
    MEMCPY(p->payload, ipr->orig_hdr, sizeof(iprh));


Should it be sizeof(*iprh) or some symbolic constant?

I'm using the latest master branch 3fe8d2fc43a9b69f7ed28c63d44a7744f9c0def9.

Jarno Malmari <jmalmari>

 

(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 goldsimon (Posted a comment)
  • -email is unavailable- added by jmalmari (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.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-10-03 goldsimon StatusNone Fixed
        Assigned toNone goldsimon
        Open/ClosedOpen Closed
        Planned ReleaseNone 2.2.1

    Back to the top

    Powered by Savane 3.13-269c.
    Corresponding source code