Listing 4. example2.c (vulnerable to a heap-based buffer overflow).
清单4 . example2 . c(容易出现基于堆的缓冲区溢出)。
Listing 1. example1.c (vulnerable to a heap-based buffer overflow).
清单1 . example1 . c(容易出现基于堆的缓冲区溢出)。
The following example is vulnerable to a heap-based buffer overflow
以下示例容易出现基于堆的缓冲区溢出
Listing 1 does not validate user-supplied data when copying it to the buffer member of the previously allocated struct mystruct using the strcpy function, resulting in a heap-based buffer overflow.
在使用strcpy函数将用户提供的数据复制到先前分配的struct mystruct的buffer成员中时,清单1不验证用户提供的数据,造成堆中缓冲区溢出。
Listing 1 does not validate user-supplied data when copying it to the buffer member of the previously allocated struct mystruct using the strcpy function, resulting in a heap-based buffer overflow.
在使用strcpy函数将用户提供的数据复制到先前分配的struct mystruct的buffer成员中时,清单1不验证用户提供的数据,造成堆中缓冲区溢出。
应用推荐