相关疑难解决方法(0)

为什么获取功能如此危险以至于不应该使用它?

当我尝试编译使用gets()GCC函数的C代码时,

我明白了

警告:

(.text + 0x34):警告:`gets'函数很危险,不应该使用.

我记得这与堆栈保护和安全性有关,但我不确定为什么?

有人可以帮我删除这个警告并解释为什么会有这样的使用警告gets()

如果gets()是如此危险,为什么我们不能删除它?

c gets fgets buffer-overflow

210
推荐指数
9
解决办法
14万
查看次数

为什么python2和python3中的print输出与同一个字符串不同?

在python2中:

$ python2 -c 'print "\x08\x04\x87\x18"' | hexdump -C
00000000  08 04 87 18 0a                                    |.....|
00000005
Run Code Online (Sandbox Code Playgroud)

在python3中:

$ python3 -c 'print("\x08\x04\x87\x18")' | hexdump -C
00000000  08 04 c2 87 18 0a                                 |......|
00000006
Run Code Online (Sandbox Code Playgroud)

为什么"\xc2"这里有字节?

编辑:

我认为当字符串具有非ascii字符时,python3会将字节附加"\xc2"到字符串.(正如@Ashraful Islam所说)

那我怎么能在python3中避免这种情况呢?

python unicode utf-8

8
推荐指数
2
解决办法
1232
查看次数

标签 统计

buffer-overflow ×1

c ×1

fgets ×1

gets ×1

python ×1

unicode ×1

utf-8 ×1