ChinaUnix.net
相关文章推荐:

Gets replaced by RomLoader with real address

我写的c程序在gcc编译时提示 gets危险, 我想问问大家怎么得到终端的字符串输入的. 我换了如下的做法代替gets, 不知道好不好 char buf[128]; fgets (buf, 128, stdin); buf [strlen(buf)] = '\0';

by xxandxx - 程序开发 - 2005-12-12 23:11:19 阅读(504) 回复(1)

相关讨论

我写的c程序在gcc编译时提示 gets危险, 我想问问大家怎么得到终端的字符串输入的. 我换了如下的做法代替gets, 不知道好不好 char buf[128]; fgets (buf, 128, stdin); buf [strlen(buf)] = '\0';

by xxandxx - Linux环境编程 - 2005-12-12 23:11:19 阅读(1167) 回复(1)

OpenSolaris cancelled, to be replaced with Solaris 11 Express http://mail.opensolaris.org/pipermail/opensolaris-discuss/2010-August/059310.html Alasdair Lumsden alasdairrr at gmail.com Fri Aug 13 15:40:32 UTC 2010 Hi All, This memo was circulated internally within Oracle (and subsequently leaked). Basically, the open source development model has now been axed and OpenSolaris is officially now ...

by linton - Solaris - 2010-08-14 17:50:25 阅读(1671) 回复(0)
by a1234567mdy - 数据安全 - 2011-12-22 08:53:39 阅读(780) 回复(0)

gets函数的危险性 gets函数和fgets函数最大的不同是gets函数的缓冲区虽然由用户提供,但是用户无法指定其一次最多读入多少字节的内容。这一点导致gets变成了一个非常危险的函数。 下例演示了gets函数的危险性。该程序定义了一个缓冲区,但是使用gets函数接收用户输入的字符串时却会出现问题。 (1)在vi编辑器中编辑该程序如下: 程序清单21-5 risk.c 利用gets函数的漏洞进行缓冲区攻击 #include stdio.h>int main(void) { /* 这个...

by skyily - Linux文档专区 - 2009-06-29 21:13:06 阅读(897) 回复(0)

#include #include main() { char buf[33][11]; for(i=0;i<3;i++) gets(buf); printf("*%c*\n",buf[1][1]); } 输入: woshi(回车) (回车) haichong(回车) 输出: *? 这是怎么回事啊?gets收都回车的时候会怎么做啊?

by 我是害虫 - C/C++ - 2008-03-10 23:46:29 阅读(1345) 回复(5)

fgets:读入一串字符。当遇到以下情况之一时将停止读入而返回; 读入的字符数已经到达n-1个(因为该函数要求指定允许读入的最大字符数,并且为读入的字符串添加‘\0’因此读入的字符最多是n-1) 遇到一个换行符 它是一个理想的每次读一行的函数。 gets:从标准输入设备中读入一串字符,直到遇到换行符为止。它是一个不推荐使用的函数。由于调用者没有指定缓存的长度,可能会造成缓存越界,从而有安全隐患。另外,它也不会将换行符存...

by carol79 - Linux文档专区 - 2007-01-08 22:08:38 阅读(630) 回复(0)

我再linux用gcc编译c程序的时候,用gets函数的话,就老是给我下面的警告信息: /tmp/ccyhTLKy.o(.text+0x53): In function `main': : the `gets' function is dangerous and should not be used. 这是怎么会事啊? 不用gets,用scanf的话,读字符串,到空格就结束了.怎么改呢?

by aero - C/C++ - 2004-03-04 15:58:27 阅读(1278) 回复(2)

今天 装了一个real播东西卡,基本没什么意思了。red hat 9.0 怎么回事?

by Pacer - 多媒体与娱乐 - 2006-05-29 07:40:09 阅读(1274) 回复(1)

今天 装了一个real播东西卡,基本没什么意思了。red hat 9.0 怎么回事?

by Pacer - Linux新手园地 - 2006-05-29 07:40:09 阅读(1344) 回复(1)