#99 src/libical/sspm.c:706: possible bad use of sizeof ?

None
closed-accepted
nobody
None
5
2014-06-01
2014-04-09
dcb
No

libical-1.0/src/libical/sspm.c:706:32: warning: 'strncmp' call operates on objects of type 'char' while the size is based on a different type 'char *' [-Wsizeof-pointer-memaccess]

    if(strncmp((line+2),parent_header->boundary,
           sizeof(parent_header->boundary)) == 0){

Suggest code rework.

Discussion

  • Here is a patch to resolve this warning. I assume that sspm_header.boundary is a null-terminated string and just use strcmp. If this is not a valid assumption, then the code does need some reworking to store the size of the buffer.

    This patch also resolves a similar warning in icaltimezone.c.

     
    Attachments
  • Allen Winter
    Allen Winter
    2014-06-01

    • status: open --> closed-accepted
    • Group: -->
     
  • Allen Winter
    Allen Winter
    2014-06-01

    pushed in the new git repo with commit 07c7791dd49c73eef04966fbbabcd632f0921e1a

    Thanks.

    please not we have moved the code to github.com in the libical/libical repo.
    please follow us there from now on.