荔园在线
荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀
[回到开始]
[上一篇][下一篇]
发信人: Soaris@smth.org (Say Something Stupid), 信区: InstallBBS
标 题: Re: innbbsd+FreeBSD-HOWTO[转载]
发信站: BBS 水木清华站 (Sun Aug 4 16:23:37 2002)
转信站: SZUBBS!news.happynet.org!maily.cic.tsinghua.edu.cn!SMTH
建议linux下也这样修改,sprintf一定是溢出的,只不过没有冲掉port的symbol而已
FreeBSD下用-O编译时这个溢出是罪魁,加static只是改变了port的存储位置,溢出还是发生
了的
具体过程调试一下就知道了
【 在 Soaris (Say Something Stupid) 的大作中提到: 】
: 我是在standaloneinit()里面,作了如下修改:
: -char pidfile[24];
: +char pidfile[30];
: ....
: -sprintf(pidfile,"/usr/tmp/innbbsd-%s.pid", port);
: +snprintf(pidfile,sizeof(pidfile),"/usr/tmp/innbbsd-%s.pid", port);
: 这样就好了
: sprintf有overflow嫌疑.
: 奇怪的是我调试时用-g编译没问题,用-O编译port就变null了,ft
--
When the Blue Night is over my face ,
On the dark side of the world in Space
When I'm all alone with the stars above ,
You are the one I love
※ 来源:·BBS 水木清华站 smth.edu.cn·[FROM: 166.111.168.18]
[回到开始]
[上一篇][下一篇]
荔园在线首页 友情链接:深圳大学 深大招生 荔园晨风BBS S-Term软件 网络书店