缓冲区溢出(VS)缓冲区溢出(VS)堆栈溢出 [英] Buffer Overflow (vs) Buffer OverRun (vs) Stack Overflow

查看:2321
本文介绍了缓冲区溢出(VS)缓冲区溢出(VS)堆栈溢出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:

  <一href=\"http://stackoverflow.com/questions/1120575/what-is-the-difference-between-a-stack-overflow-and-buffer-overflow\">What是一个堆栈溢出之间的差异,缓冲区溢出?

什么是缓冲区溢出和缓冲区溢出的区别?

What is the difference between Buffer Overflow and Buffer Overrun?

什么是缓冲区溢出和堆栈溢出的区别?

What is the difference between Buffer Overrun and Stack Overflow?

请包括code的例子。我已经看过维基百科条款,但我无法匹配与C或C ++或Java编程。

Please include code examples. I have looked at the terms in Wikipedia, but I am unable to match with programming in C or C++ or Java.

推荐答案

想想一个缓冲区只是一个数组。 A 缓冲区溢出是当你试图把更多的项目数组比该阵列可以容纳英寸换句话说,它来自的 的。

Think of a buffer as just an array. A buffer overflow is when you try to put more items in the array than what the array can hold. In other words, it comes from writing.

A 缓冲区溢出是当你遍历缓冲区,并继续阅读过去的数组的末尾。换句话说,它来自的 阅读

A buffer overrun is when you are iterating over the buffer and keep reading past the end of the array. In other words, it comes from reading.

一个堆栈溢出有很大不同。大多数现代编程环境是基于堆栈,在那里他们使用一个堆栈数据结构,以控制程序流程。每次你调用一个函数的时候,一个新的项目放在程序的调用堆栈上。当函数返回时,该项目被弹出堆栈。当堆栈是空的,程序停止。的是,这个堆具有固定大小,所以有可能在一次调用太多功能。在这一点上,你有一个堆栈溢出。要做到这一点最常用的方法是调用自身的函数(递归)。

A stack overflow is much different. Most modern programming environments are stack-based, where they use a stack data structure to control program flow. Every time you call a function, a new item is placed on the program's call stack. When the function returns, the item is popped of the stack. When the stack is empty, the program stops. The thing is that this stack has a fixed size, and so it is possible to call too many functions at one time. At this point you have a stack overflow. The most common way to do this is with a function that calls itself (recursion).

这篇关于缓冲区溢出(VS)缓冲区溢出(VS)堆栈溢出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆