Query module StrncpyFlippedArgs

name
Possibly wrong buffer size in string copy
description
Calling ‘strncpy’ with the size of the source buffer as the third argument may result in a buffer overflow.
kind
problem
problem.severity
warning
precision
medium
id
cpp/bad-strncpy-size
tags
reliability correctness security external/cwe/cwe-676 external/cwe/cwe-119 external/cwe/cwe-251

Imports

Buffer
cpp

Provides classes and predicates for working with C/C++/ObjC/ObjC++ code.

Predicates

arrayExprFixedSize

Gets the size of the expression, if it is initialized with a fixed size array.

isSizePlus
nthString
strncpyFunction