[LLVMbugs] [Bug 10919] New: CStringChecker.cpp Size argument is greater than the length of the destination buffer
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Sep 12 19:36:43 PDT 2011
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: unassignedclangbugs at nondot.org
ReportedBy: wdzz2008 at sina.com
CC: llvmbugs at cs.uiuc.edu
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.
More information about the llvm-bugs
mailing list