http://llvm.org/bugs/show_bug.cgi?id=10919

           Summary: CStringChecker.cpp Size argument is greater than the
                    length of the destination buffer
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


test example:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef struct _XMLNode {
    char* tag;                    /* Tag name */

} XMLNode;

int XML_parse_1string(char* str, XMLNode* xmlnode)
{
    int n ,tag_end = 0;
    n = 1+tag_end;
    xmlnode->tag = (char*)malloc(n - tag_end);
    if (xmlnode->tag == NULL) return 0;
    strncpy(xmlnode->tag, str+1+tag_end, n-1-tag_end); //it is not a weakness
    return 0;
}

this example result a weakness which is "Size argument is greater than the
length of the destination buffer", but really it is not a weakness

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to