Skip to content

How can I find all of the access of a pointer? #8585

Answered by geoffw0
Just1ceP4rtn3r asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

This is a bit tricky for subtle reasons. For an expression such as a->b, the taint library tracks taint of the pointer a separately from its content accessed by a->b. In your case, List may be tainted while List->next->next is not. We can work around this by adding a custom taint step (isAdditionalTaintStep).

Additionally, the taint library doesn't (yet) fully support taint flows from global variable initializers, so we will get better results if we start from accesses to those variables instead.

This is the best I've come up with:

import cpp
import semmle.code.cpp.dataflow.TaintTracking
import DataFlow::PathGraph

/**
 * Holds if `v` is a global variable called `List`, or another glo…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@Just1ceP4rtn3r
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by Just1ceP4rtn3r
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
2 participants