File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3232 <optional >
3333 <attribute name =" arg" ><ref name =" ARGNO" /></attribute >
3434 </optional >
35+ <optional >
36+ <attribute name =" buffer-size" ><ref name =" DATA-BUFFER-SIZE" /></attribute >
37+ </optional >
3538 <ref name =" DATA-NAME" />
3639 </element >
3740 <element name =" use" ><ref name =" DATA-EXTNAME" /></element >
458461 </data >
459462 </define >
460463
464+ <define name =" DATA-BUFFER-SIZE" >
465+ <data type =" string" >
466+ <param name =" pattern" >arg-value:[1-3]</param >
467+ </data >
468+ </define >
469+
461470 <define name =" CONTAINER-ACTION" >
462471 <choice >
463472 <value >resize</value >
Original file line number Diff line number Diff line change @@ -7320,7 +7320,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
73207320 <arg nr="2"/>
73217321 </function>
73227322 <memory>
7323- <alloc init="false">malloc</alloc>
7323+ <alloc init="false" buffer-size="arg-value:1" >malloc</alloc>
73247324 <alloc init="true">calloc</alloc>
73257325 <alloc init="false">aligned_alloc</alloc>
73267326 <alloc init="false">valloc</alloc>
Original file line number Diff line number Diff line change @@ -200,6 +200,13 @@ Library::Error Library::load(const tinyxml2::XMLDocument &doc)
200200 temp.arg = atoi (arg);
201201 else
202202 temp.arg = -1 ;
203+
204+ const char *bufferSize = memorynode->Attribute (" buffer-size" );
205+ if (bufferSize && std::strncmp (bufferSize, " arg-value:" , 10 ) == 0 )
206+ temp.bufferSizeArgValue = bufferSize[10 ] - ' 0' ;
207+ else
208+ temp.bufferSizeArgValue = -1 ;
209+
203210 mAlloc [memorynode->GetText ()] = temp;
204211 } else if (memorynodename == " dealloc" ) {
205212 AllocFunc temp;
Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ class CPPCHECKLIB Library {
7373 struct AllocFunc {
7474 int groupId;
7575 int arg;
76+ int bufferSizeArgValue;
7677 };
7778
7879 /* * get allocation info for function */
You can’t perform that action at this time.
0 commit comments