Splint Personal Guidance

Splint

Install

Attention: Need -xvf splint-3.1.2.src.tgz or cause Error.

Need command Make aviliable first.

tar -xvf splint-3.1.2.src.tgz

cd splint-3.1.2

./configure --prefix=/usr/local/splint

# To avoid permission denied in make process, use sudo


sudo make && sudo make install 

Deploy

  1. Open ~./bashrc
  2. Add following instruction:
export LARCH_PATH=/usr/local/splint/share/splint/lib
export LCLIMPORTDIR=/usr/local/splint/share/splint/import
export PATH=/usr/local/splint/bin:$PATH 
  1. Enable new bashrc,usesource ~/.bashrc
  2. Finished.

Parameter scheme

Here are some useful Parameter

+:open
-:close

varuse: If check the use of variable

showcol:If Show column?

?

When detecting stack overflow,use parameter like:
+bounds

When format string overflow,use:
-weak +ignoresigns + formatconst +formattype

Add -linelen %d to sort the format of output

This tool can be used in the following bugs:

  • stack overflow
  • Format string
  • Empty pointer

Reference:https://blog.csdn.net/xiaowang1379214245/article/details/82688802

Command Example

Stack overflow

splint +weak +bounds -hints +ignoresigns stackof0.c

Output:

Splint 3.1.2 --- 09 Sep 2019

stackof0.c: (in function func)
stackof0.c:10:2: Possible out-of-bounds store: strcpy(buf, in)
    Unable to resolve constraint:
    requires maxRead(in @ stackof0.c:10:14) <= 9
     needed to satisfy precondition:
    requires maxSet(buf @ stackof0.c:10:9) >= maxRead(in @ stackof0.c:10:14)
     derived from strcpy precondition: requires maxSet(<parameter 1>) >=
    maxRead(<parameter 2>)

Format overflow

asr@ubuntu-18-04-3-lts-course-design:~/Documents/COURSEDESIGNTEST/Source$ splint -weak +ignoresigns +formatconst +formattype '/home/asr/Documents/COURSEDESIGNTEST/test/Formattest.c' 
Splint 3.1.2 --- 09 Sep 2019

Command Line: Setting +formattype redundant with current value
../test/Formattest.c: (in function main)
../test/Formattest.c:5:30: Format argument 3 to printf (%s) expects char * gets
                              int: b
  Type of parameter is not consistent with corresponding code in format string.
  (Use -formattype to inhibit warning)
   ../test/Formattest.c:5:21: Corresponding format code

Finished checking --- 1 code warning

Very important:when use re.findall,see https://blog.csdn.net/tp7309/article/details/72823258

1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。、可私 6信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 、可私信6博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 、可私信6博主看论文后选择购买源代码。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值