File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
c/common/src/codingstandards/c Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -82,9 +82,10 @@ module OOB {
82
82
dst = - 1 and
83
83
src = [ 0 , 1 ]
84
84
or
85
- name = "strtok" and
86
- dst = 0 and
87
- src = 1
85
+ // do not specify a src and dst to avoid buffer size assumptions
86
+ name = [ "strtok" , "strtok_r" ] and
87
+ dst = - 1 and
88
+ src = [ 0 , 1 ]
88
89
)
89
90
}
90
91
@@ -479,6 +480,18 @@ module OOB {
479
480
}
480
481
}
481
482
483
+ /**
484
+ * A `BufferAccessLibraryFunction` modelling `strtok`
485
+ */
486
+ class StrtokLibraryFunction extends BufferAccessLibraryFunction {
487
+ StrtokLibraryFunction ( ) { this .getName ( ) = getNameOrInternalName ( [ "strtok" , "strtok_r" ] ) }
488
+
489
+ override predicate getAPermissiblyNullParameterIndex ( int i ) {
490
+ // `strtok` does not require a non-null `str` parameter
491
+ i = 0
492
+ }
493
+ }
494
+
482
495
/**
483
496
* An construction of a pointer to a buffer.
484
497
*/
You can’t perform that action at this time.
0 commit comments