Note that there are some explanatory texts on larger screens.

plurals
  1. POsplint how to perform taint analysis
    primarykey
    data
    text
    <p>How to perform Taint Analysis using Splint?</p> <p>I have installed Splint on my Ubuntu 12.04. Created a small test case as below:</p> <pre><code>#include&lt;stdio.h&gt; #include&lt;string.h&gt; int main(int argc, char *argv[]) { char a[10]; strncpy(a,argv[1],10); printf(a); return 0; } </code></pre> <p>Also created splint.xh file with the following contents:</p> <pre><code>int printf (/*@untainted@*/ char *fmt, ...); char *fgets (char *s, int n, FILE *stream) /*@ensures tainted s@*/ ; char *strcat (/*@returned@*/ char *s1, char *s2) /*@ensures s1:taintedness = s1:taintedness | s2:taintedness @*/ ; void strncpy (/*@returned@*/ char *s1, char *s2, size_t num) /*@ensures s1:taintedness = s1:taintedness | s2:taintedness @*/ ; </code></pre> <p>Also created splint.mts file with the below contents:</p> <pre><code> attribute taintedness context reference char * oneof untainted, tainted annotations tainted reference ==&gt; tainted untainted reference ==&gt; untainted transfers tainted as untainted ==&gt; error "Possibly tainted storage used where untainted required." merge tainted + untainted ==&gt; tainted defaults reference ==&gt; tainted literal ==&gt; untainted null ==&gt; untainted end </code></pre> <p>Then finally ran the splint tool with the command:</p> <pre><code> splint -mts splint prg001.c </code></pre> <p>Where prg001.c is the sample input, "splint" refers to splint.mts and splint.xh file. All the files are in the current directory.</p> <p>The output I received is:</p> <p>Splint 3.1.2 --- 21 Aug 2012</p> <p>prg001.c: (in function main) prg001.c:6:1: Format string parameter to printf is not a compile-time constant: a Format parameter is not known at compile-time. This can lead to security vulnerabilities because the arguments cannot be type checked. (Use -formatconst to inhibit warning) prg001.c:3:14: Parameter argc not used A function parameter is not used in the body of the function. If the argument is needed for type compatibility or future plans, use /<em>@unused@</em>/ in the argument declaration. (Use -paramuse to inhibit warning)</p> <p>Finished checking --- 2 code warnings</p> <p>There is no hint of any taint analysis in the output. Can someone please help me on how to get the taint analysis done using Splint.</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload