CWE一覧に戻る
CWE-469

サイズを決定するためのポインタ減算の使用

Use of Pointer Subtraction to Determine Size
脆弱性 レビュー中
JA

この積は、サイズを決定するために、あるポインタから別のポインタを引くが、ポインタが同じメモリチャンクに存在しない場合、この計算が間違っている可能性がある。

EN

The product subtracts one pointer from another in order to determine size, but this calculation can be incorrect if the pointers do not exist in the same memory chunk.

Scope: Access Control, Integrity, Confidentiality, Availability / Impact: Modify Memory; Read Memory; Execute Unauthorized Code or Commands; Gain Privileges or Assume Identity
Save an index variable. This is the recommended solution. Rather than subtract pointers from one another, use an index variable of the same size as the pointers in question. Use this variable to "walk" from one pointer to the other and calculate the difference. Always validate this number.
MITRE公式ページ — CWE-469