splint ("secure programming lint") is a lint implementation, i.e. a tool for statically checking C programs for security vulnerabilities and coding mistakes. With minimal effort, Splint can be used as a better lint. If additional effort is invested adding annotations to programs, Splint can perform stronger checking than can be done by any standard lint.
Questions tagged [splint]
84 questions
25
votes
1 answer
Recommended way to track down array out-of-bound access/write in C program
Consider writing implementation for some not-so-obvious algorithm in C. For example let it be recursive quicksort, that I have found in K. N. King's "C Programming: A Modern Approach, 2nd Edition" book, that it's available from here. The most…

Grzegorz Szpetkowski
- 36,988
- 6
- 90
- 137
18
votes
3 answers
Does a C shift expression have unsigned type? Why would Splint warn about a right-shift?
For the following program:
int main(void)
{
int value = 2;
int result = value >> 1U;
return result;
}
...Splint 3.1.2 gives the warning:
splint_test.c: (in function main)
splint_test.c:4:18: Variable result initialized to type unsigned…

detly
- 29,332
- 18
- 93
- 152
8
votes
1 answer
splint: parse error in for loop
I am using splint as static analyzer for c99 code.
Splint seems to be not quite c99 compliant. Thus I have applied this patch:
http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20080718/52cc25f6/attachment.obj
Now I get no parse errors…

tobias
- 2,322
- 3
- 33
- 53
7
votes
1 answer
Odd Behavior From Splint Bounds Checking
Any splint experts out there?? I'm trying to use splint to statically analyze a large project I have in C. I'm seeing an excess number of bounds checking errors that are obviously not bounds errors. I wrote a small test program to try to isolate the…

Samuel
- 8,063
- 8
- 45
- 41
6
votes
4 answers
How can I make splint ignore where I declare my variables?
Do you know how can I make splint ignore where I declare my variables?
I know that the old school c tells you to declare variables right at the
beginning in every function,
but since I am a bad person I like to declare things close to where I use…

Johan
- 20,067
- 28
- 92
- 110
6
votes
2 answers
splint debugging parse error
This is my first time using splint (from Ubuntu repositories) and I immediately got hit by a WTF. The error message:
nightcracker@nightcracker-pc:~/c/brainfuck$ splint brainfuck.c
Splint 3.1.2 --- 03 May 2009
brainfuck.c:17:6: Parse Error. (For…

orlp
- 112,504
- 36
- 218
- 315
6
votes
2 answers
WhiteSpaces in .splintrc preprocessor directive -D
I want to run splint on some of my sources within a debian stable environment.
I need to give the preprocessor directive -DUINT16_T='unsigned short' and as I need that very often. I'd like to place it inside my .splintrc file.
When running from…

Bastian Ebeling
- 1,138
- 11
- 38
5
votes
2 answers
splint vs gcc: are external static code analysis tools worth the effort for C codebases?
I'm working on a fairly complex project, and as an added complication it's an in-kernel Linux module. Running a linting tool like splint on such a codebase is certainly not impossible [1], but trivial effort was not enough to get something…

tramdas
- 448
- 2
- 10
5
votes
0 answers
splint: ask not to check system headers
Is there a way to stop splint from analyzing system headers included, POSIX, libc etc.? I run with -warnposix -preproc:
% splint -warnposix -preproc my.c
/usr/include/unistd.h:220:8: Parse Error: Non-function declaration:
__BEGIN_DECLS : int.…

Mark
- 6,052
- 8
- 61
- 129
5
votes
5 answers
Splint Code Analyzers for C
We are planning to use Splint as code analyzer for our C code base. But we never tried Splint tool before so we want your input on it's benifts, pros and cons.

Thi
- 2,297
- 7
- 26
- 36
4
votes
2 answers
How to include header files while checking a source code with splint tool?
I created 2 C program source code files and one header file which just contains a function declaration.
mypattern.h
#include
void pattern_check(char *,int,char *);
pattern_main.c
#include
int main(int argc,char…

Dinesh
- 16,014
- 23
- 80
- 122
4
votes
1 answer
Splint: local variable used before definition
I know local variables can have "random" value when not set, but is it bad to set the first value of a local variable with a pointer? For example:
void setValue(int* p_val)
{
*p_val = …; /* Assignment does not use *p_val */
}
int main(void)
{
…

Octribin
- 192
- 1
- 7
4
votes
6 answers
Why does Splint (the C code checker) give an error when comparing a float to an int?
Both are mathematical values, however the float does have more precision. Is that the only reason for the error - the difference in precision? Or is there another potential (and more serious) problem?

Thomas Owens
- 114,398
- 98
- 311
- 431
4
votes
2 answers
Is it legal to use a variable in a struct initializer in C?
The following code seems to compile fine.
typedef struct Test {
int i;
int j;
} Test;
int main() {
int i;
i = 0;
Test p = {i, 1};
printf("%d\n", p.i);
return 0;
}
Splint fails with
example2.c:9:7: Parse Error. (For help on parse…

George Simms
- 3,930
- 4
- 21
- 35
4
votes
0 answers
Splint: Parsing Error at the time of static checking
I am new to static checking and I am assigned a task to do static checking of C code. I am given the liberty to select any one tool keeping in mind that the organisation already uses lint so a lint based tool should be preferred.
I selected splint…

user2435273
- 49
- 4