@@ -146,6 +146,9 @@ class StrCopyBW extends BufferWriteCall {
146
146
)
147
147
}
148
148
149
+ /**
150
+ * Gets the index of the parameter that is the maximum size of the copy (in characters).
151
+ */
149
152
int getParamSize ( ) {
150
153
exists ( TopLevelFunction fn , string name |
151
154
fn = getTarget ( ) and
@@ -161,6 +164,9 @@ class StrCopyBW extends BufferWriteCall {
161
164
)
162
165
}
163
166
167
+ /**
168
+ * Gets the index of the parameter that is the source of the copy.
169
+ */
164
170
int getParamSrc ( ) {
165
171
exists ( TopLevelFunction fn , string name |
166
172
fn = getTarget ( ) and
@@ -194,8 +200,14 @@ class StrCopyBW extends BufferWriteCall {
194
200
class StrCatBW extends BufferWriteCall {
195
201
StrCatBW ( ) { exists ( TopLevelFunction fn | fn = getTarget ( ) and fn instanceof StrcatFunction ) }
196
202
203
+ /**
204
+ * Gets the index of the parameter that is the maximum size of the copy (in characters).
205
+ */
197
206
int getParamSize ( ) { if exists ( getArgument ( 2 ) ) then result = 2 else none ( ) }
198
207
208
+ /**
209
+ * Gets the index of the parameter that is the source of the copy.
210
+ */
199
211
int getParamSrc ( ) { result = 1 }
200
212
201
213
override Type getBufferType ( ) {
@@ -349,6 +361,9 @@ class SnprintfBW extends BufferWriteCall {
349
361
)
350
362
}
351
363
364
+ /**
365
+ * Gets the index of the parameter that is the size of the destination (in characters).
366
+ */
352
367
int getParamSize ( ) { result = 1 }
353
368
354
369
override Type getBufferType ( ) {
@@ -399,6 +414,9 @@ class GetsBW extends BufferWriteCall {
399
414
)
400
415
}
401
416
417
+ /**
418
+ * Gets the index of the parameter that is the maximum number of characters to be read.
419
+ */
402
420
int getParamSize ( ) { if exists ( getArgument ( 1 ) ) then result = 1 else none ( ) }
403
421
404
422
override Type getBufferType ( ) { result = this .getTarget ( ) .getParameter ( 0 ) .getUnspecifiedType ( ) }
@@ -434,6 +452,9 @@ class ScanfBW extends BufferWrite {
434
452
)
435
453
}
436
454
455
+ /**
456
+ * Gets the index of the parameter that is the first format argument.
457
+ */
437
458
int getParamArgs ( ) {
438
459
exists ( FunctionCall fc |
439
460
this = fc .getArgument ( _) and
0 commit comments