荔园在线

荔园之美,在春之萌芽,在夏之绽放,在秋之收获,在冬之沉淀

[回到开始] [上一篇][下一篇]


发信人: Soaris@smth.org (Say Something Stupid), 信区: InstallBBS
标  题: Re: innbbsd+FreeBSD-HOWTO[转载]
发信站: BBS 水木清华站 (Sun Aug  4 14:20:06 2002)
转信站: SZUBBS!news.happynet.org!maily.cic.tsinghua.edu.cn!SMTH

我是在standaloneinit()里面,作了如下修改:

-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

【 在 flyriver (江~~一周两个CGI) 的大作中提到: 】
: 一开始我这边也出现了这种 (null) 和 1904 的现象,当时还用 gdb 跟了一下,
: 但没有看到 port 和 path 是怎么变没的,很神奇。于是在
: inndchannel.c: main() 中加了一行 printf()。
:     initial_bbs("feed");
:     path = LOCALDAEMON;
: +   printf("port = %s\n", port);
:     if (!inetdstart)
:       fprintf(stderr, "Try to listen in port %s and path %s\n", port, path);
: 本来是为了 debug 用的,没想到的是,加了这么一句话之后 innbbsd 居然就
: 可以正常启动了。
: $ ./innbbsd
: ...................

--
    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软件 网络书店