stack

An intended buffer overflow that does not always cause the program to crash

喜欢而已 提交于 2019-12-10 22:42:39
问题 Consider The following minimal C program: Case Number 1 : #include <stdio.h> #include <string.h> void foo(char* s) { char buffer[10]; strcpy(buffer,s); } int main(void) { foo("01234567890134567"); } This doesn't cause a crash dump If add just one character, so the new main is: Case Number 2 : void main() { foo("012345678901345678"); ^ } The program crashes with a Segmentation fault. Looks like additionally to the 10 characters reserved in the stack there's an additional room for 8 additional

VBA System.Collections.Queue

烈酒焚心 提交于 2019-12-10 21:48:20
问题 I just discovered here the 'built-in' Stacks and Queues available from VBA. The way it's written, I can't see the properties and methods of the Queue object. Dim queue As Object Set queue = CreateObject("System.Collections.Queue") 'Create the Queue queue.Enqueue "Hello" 'VBE does not show the available properties and methods So my question is: is there a reference I can use that will allow me to have early binding and benefit from the VBE autocomplete ? Something like: Dim queue As System

Should I use the stack for long-term variable storage?

若如初见. 提交于 2019-12-10 21:43:42
问题 According to "Storage for Short Term", Chapter 8 in "Assembly Language Step by Step" (3rd Edition): The stack should be considered a place to stash things for the short term. Items stored on the stack have no names, and in general must be taken off the stack in the reverse order in which they were put on. Last in, first out, remember. LIFO! However, according to my knowledge, C compilers use the stack for basically everything. Does that mean that the stack is the best way of storing variables

push operation on stack using linked list fails

自古美人都是妖i 提交于 2019-12-10 18:39:03
问题 I am trying to create a stack using single linked list, my push operation doesn't insert data into the linked list This is what I have tried so far, typedef struct element { int data; struct element *next; }node; The push method void push(node *root, int data) { if(root == NULL) { root = (node *) malloc (sizeof(struct element)); root->data = data; root->next = NULL; } else { node *temp = (node *) malloc (sizeof(struct element)); temp->data = data; temp->next = root; root = temp; } } In my

Stack Smashing in Java Interposer

半腔热情 提交于 2019-12-10 18:38:48
问题 I am writing a Java interposer to modify network communication related system calls. Basically, I want to modify the IP and port of the intended recipient. The code works correctly on my laptop, but on university PC, it gives a stack smashing error as: *** stack smashing detected ***: java terminated ======= Backtrace: ========= /lib/i386-linux-gnu/libc.so.6(__fortify_fail+0x45)[0xb7702dd5] /lib/i386-linux-gnu/libc.so.6(+0xffd8a)[0xb7702d8a] /home/mwaqar/vibe/ldinterposer_2.so(+0x28e4)

free.c throws exception with “this program has stopped working”

早过忘川 提交于 2019-12-10 17:28:02
问题 When I run the program (server.exe) with Visual C++ 2010 Express's debugger, it runs perfectly, but when I run it as an exe it does not; it crashes with a "Server.exe has stopped working" dialog. Next I renamed the exe to "ServerInstaller.exe" and it worked, so I figured it is a permissions error, BUT it does not work with "Server.exe" in adminstrator mode. I then attached the debugger in VC++ to the "Server.exe" program, and it came up with an exception in "free.c". The code in this file is

Instruction sequence that does the same thing as push

ⅰ亾dé卋堺 提交于 2019-12-10 17:16:35
问题 I would like to know if it is possible (and if so, how) to write a sequence of instructions that would have the same effect as push . For example, if the contents of ax is 1200 , and I do a push ax , what other instructions can I use to accomplish what push ax does? 回答1: Some other answers use [sp] for stack addressing, but it is not possible in 16-bit mode, nor in 32-bit or 64-bit modes either. However, in 32-bit mode you can use [esp] and in x86-64 you can use [rsp] for memory addressing,

How do you pass a Lua Function to a C Function and execute the Lua Function Several Times?

99封情书 提交于 2019-12-10 17:13:34
问题 What I want to do is create a function that will iterate through some objects and call a function for each function. I'm using BlitzMax, not C, but that is besides the point because it has a full wrapper of Lua's C functions. Lua has a lua_pushcfunction() command, but where's it's lua_pushfunction() command? It is very easy to call functions that have a name, but how do you call a function that was passed as a argument? Something like: ForEach( PlanetList, function (planet) if(planet.exists =

React Native: TypeError: undefined is not an object (evaluating 'this.props.navigation.navigate')

风格不统一 提交于 2019-12-10 16:49:37
问题 Being a beginner in react-native, I can't figure out the problem in my code. By reading on the internet, I have an idea that I have some binding issue maybe. So, my code starts with index.js and registers the App component over there. The app component just contains the stack navigation routes. It load the LoginScreen component (displays logo, background and name of the application) which in turn loads LoginForm component. There is no authentication on the Login button and the only thing I

Execute code in process's stack, on recent Linux

馋奶兔 提交于 2019-12-10 15:47:56
问题 I want to use ptrace to write a piece of binary code in a running process's stack. However, this causes segmentation fault (signal 11). I can make sure the %eip register stores the pointer to the first instruction that I want to execute in the stack. I guess there is some mechanism that linux protects the stack data to be executable. So, does anyone know how to disable such protection for stack. Specifically, I'm trying Fedora 15. Thanks a lot! After reading all replies, I tried execstack,