无效*易受伤害 [英] Is void* vulnerable
问题描述
是否易于使用void *在程序中作为返回类型或
作为变量的类型。
是否导致任何利用程序的利用
strcpy()
导致对progarm的某种利用?
Is it vulnerable to use "void *" in the program as a return type or
as a TYPE of variable.
Does it lead to any exploitation of program in any means like use
strcpy( )
leads to some sort of exploitation to the progarm ?
推荐答案
Lalatendu Das写道:
Lalatendu Das wrote:
易于使用" void *"在程序中作为返回类型或
作为TYPE变量。
Is it vulnerable to use "void *" in the program as a return type or
as a TYPE of variable.
No.
No.
是否导致以任何方式利用程序
strcpy()导致对progarm的一些利用?
Does it lead to any exploitation of program in any means like use
strcpy( ) leads to some sort of exploitation to the progarm ?
No.
No.
" Lalatendu Das" < la ****** @ gmail.com在留言中写道。
"Lalatendu Das" <la******@gmail.comwrote in message .
易于使用" void *"在程序中作为返回类型或
作为变量的类型。
是否导致任何利用程序的利用
strcpy()
导致对progarm的一些利用?
Is it vulnerable to use "void *" in the program as a return type or
as a TYPE of variable.
Does it lead to any exploitation of program in any means like use
strcpy( )
leads to some sort of exploitation to the progarm ?
如果程序员不这样做,任何指针都会引入潜在的安全漏洞
控制它指向的地址。
void *必须转换为另一种类型才有用,所以
wild void *可能比任何其他类型的狂野指针更可能,
因为链中有更多的地方可以出错。
但是如果指针保存正确的地址,它指向的
对象的边界没有溢出,指针是安全的。
Any pointer introduces a potential security flaw if the programmer does not
control the address it points to.
void * must be converted to and from another type to be useful, and so a
wild void * is probably more likely than a wild pointer of any other type,
because there are more places in the chain for things to go wrong.
However if a pointer holds the correct address and the boundaries of the
object it points to are not overflowed, then pointers are safe.
" Lalatendu Das" < la ****** @ gmail.comwrote in message
news:11 ********************** @ v45g2000cwv .googlegr oups.com ...
"Lalatendu Das" <la******@gmail.comwrote in message
news:11**********************@v45g2000cwv.googlegr oups.com...
易于使用" void *"在程序中作为返回类型或
作为变量的类型。
是否导致任何利用程序的利用
strcpy()
导致对progarm的一些利用?
Is it vulnerable to use "void *" in the program as a return type or
as a TYPE of variable.
Does it lead to any exploitation of program in any means like use
strcpy( )
leads to some sort of exploitation to the progarm ?
strcpy没有任何问题。使用它的问题在于程序员而不是函数中的
。如果程序员不小心,她的app *可能*容易受到攻击。
如果你总是检查接收缓冲区是否至少为
作为发送缓冲区,没有问题:
if(strlen(sender)< = known_length_of_receiver){
strcpy(接收方,发送方) );
}
或者你可以专门使用strncpy()
-
弗雷德L. Kleinschmidt
There is nothing wrong with strcpy. The problem in using it lies in
the programmer, not in the function. If the programmer is
careless, her app *might* be vulnerable to exploitation.
If you always check that the receiving buffer is at least as
long as the sending buffer, there is no problem:
if ( strlen(sender) <= known_length_of_receiver ) {
strcpy( receiver, sender );
}
or you can exclusively use strncpy()
--
Fred L. Kleinschmidt
这篇关于无效*易受伤害的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!