设为首页
收藏本站
用户名
Email
自动登录
找回密码
密码
登录
注册
快捷导航
平台
Portal
论坛
BBS
文库
项目
群组
Group
我的博客
Space
搜索
搜索
热搜:
shell
linux
mysql
本版
用户
LinuxSir.cn,穿越时空的Linuxsir!
»
论坛
›
编程开发讨论区 —— LinuxSir.cn
›
Linux 程序设计专题讨论
›
写了一个菜程序,但在终端老是出一些提示,英文不好不明 ...
返回列表
查看:
867
|
回复:
6
写了一个菜程序,但在终端老是出一些提示,英文不好不明白是什么意思?
[复制链接]
YSM
YSM
当前离线
积分
343
IP卡
狗仔卡
发表于 2003-8-2 14:29:06
|
显示全部楼层
|
阅读模式
源程序:
#include<stdio.h>
#define MAX 81
int main(void)
{
char name[MAX];
printf("Hi,What's your name?\n");
gets(name);
printf("Nice name,%s.\n",name);
return 0;
}
复制代码
每次都出现下面的提示,但可以正确运行程序,高手帮看一下是怎么回事。
[root@localhost cai]# gcc y1.c
/tmp/ccYFUbd1.o(.text+0x28): In function `main':
: the `gets' function is dangerous and should not be used.
回复
使用道具
举报
提升卡
置顶卡
沉默卡
喧嚣卡
变色卡
显身卡
pupilzeng
pupilzeng
当前离线
积分
2280
IP卡
狗仔卡
发表于 2003-8-2 14:40:35
|
显示全部楼层
在函数'main'中
:‘get’ 是一个危险的函数,不应该使用。
至于危险的原因,我想应该是缓冲区溢出的问题。
回复
支持
反对
使用道具
举报
显身卡
libinary
libinary
当前离线
积分
1502
IP卡
狗仔卡
发表于 2003-8-2 14:46:27
|
显示全部楼层
用fgets代替。
回复
支持
反对
使用道具
举报
显身卡
YSM
YSM
当前离线
积分
343
IP卡
狗仔卡
楼主
|
发表于 2003-8-2 15:29:36
|
显示全部楼层
谢谢!
回复
支持
反对
使用道具
举报
显身卡
lordbyorn
lordbyorn
当前离线
积分
889
IP卡
狗仔卡
发表于 2003-8-2 19:29:16
|
显示全部楼层
: the `gets' function is dangerous and should not be used.
don't understand this sentence, really bad English.
or maybe just don't understand why dangerous?
回复
支持
反对
使用道具
举报
显身卡
redspider
redspider
当前离线
积分
994
IP卡
狗仔卡
发表于 2003-8-2 22:49:29
|
显示全部楼层
function "gets()" 没有溢出检测,so its dangerous.
回复
支持
反对
使用道具
举报
显身卡
Joran
Joran
当前离线
积分
14
IP卡
狗仔卡
发表于 2003-8-4 13:22:26
|
显示全部楼层
这个函数存在缓冲区漏洞(可能被黑客利用),还有象scanf(),strcat(),strcpy()等也存在。
回复
支持
反对
使用道具
举报
显身卡
返回列表
高级模式
B
Color
Image
Link
Quote
Code
Smilies
您需要登录后才可以回帖
登录
|
注册
本版积分规则
发表回复
回帖后跳转到最后一页
Copyright © 2002-2023
LinuxSir.cn
(http://www.linuxsir.cn/) 版权所有 All Rights Reserved.
Powered by
RedflagLinux!
技术支持:
中科红旗
|
京ICP备19024520号
快速回复
返回顶部
返回列表