Hi, I'm tackling a trivial buffer overflow (yes, exploitation; but unrelated to the problem) I'm trying to figure out the fields in the memory map, when GCC's stack protector is enabled. As an illustration:
$ ./overflow
*** stack smashing detected ***: ./overflow terminated
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(__for...
analyze state leak problem, why?
+ (DebugOutput *) sharedDebug
{
@synchronized(self)
{
if (sharedDebugInstance == nil)
{
[[self alloc] init];
}
}
return sharedDebugInstance;
}
...
Hi, I'm looking for a Cross-platform library for generting pure sound with adjustable level of power/voltage written in C or C++. It must not be GPL. Please share if you know any. Thanks.
...
Can anyone tell me how to insert a function call (say Yield() ) at random places inside a C function , so that each time the code is run , Yield() gets called from different parts of the code ?
I am faced with such a requirement as I'm using 2 threads in a cooperative threading environment , where unless the running thread yields the pr...
I am using a doubly linked list in a C program. I am getting confused about freeing the memory.
Should I free the list node by node?
Or, by assigning head and tail nodes to NULL?
...
Can't figure out what's wrong, I don't seem to be getting anything from fread.
port.h
#pragma once
#ifndef _PORT_
#define _PORT_
#include <string>
#ifndef UNICODE
typedef char chr;
typedef string str;
#else
typedef wchar_t chr;
typedef std::wstring str;
inline void fopen(FILE ** ptrFile, const w...
I am working with a 2-dimensional array of structs which is a part of another struct. It's not something I've done a lot with so I'm having a problem. This function ends up failing after getting to the "test" for-loop near the end. It prints out one line correctly before it seg faults.
The parts of my code which read data into a dummy ...
For some reason my buffer is getting filled with jibberish, and I'm not sure why. I even checked my file with a hex editor to verify that my characters are saved in a 2 byte unicode format. I'm not sure what's wrong.
[on file open]
fseek(_file_pointer, 0, SEEK_END);
this->_length = ftell(this->_file_pointer) / sizeof(chr);
[Main]
//...
I have a doubt regarding heap in program execution layout diagram of a C program.
I know that all the dynamically allocated memory is allotted in heap which grows dynamically. But I would like to know what is the max heap size for a C program ??
I am just attaching a sample C program ... here I am trying to allocate 1GB memory to stri...
How do you compare and sort chararrays in a linked list, cant you compare like this 'Smith' > 'Andersson' ?
struct person {
char name[20];
struct person *nextPerson;
};
.
void createNode(PersonPtr *sPtr, struct person t[]){
PersonPtr newPtr; /* pointer to new node */
PersonPtr previousPtr; /* pointer to previus node in list */
P...
It is very easy on Linux to fire-up vi and write a 100-200 lines of code, compile and see the results: ie. Trying small simple examples of C/C++ code.
On windows however, I like Visual Studio but to use it you have create a new solution then a project which then creates a new folder, generates very large PDB and caching files and a smal...
I haven't used C very much in the last few years. When I read this question today I came across some C syntax which I wasn't familiar with.
Apparently in C99 the following syntax is valid:
void foo(int n) {
int values[n]; //Declare a variable length array
}
This seems like a pretty useful feature, does anyone now if there was eve...
Hello,
This question was asked to me in an interview:
There are two header of two linked lists.
There is a merged linked list in c where in the second linked list is merged into the first one at some point.
How could we identify the merging point and what is the complexity of finding that point ?
Could anybody please help?
...
printf("%s", (char*)2189672);
2189672 is output of
char hi[4] = "hi!";
int *hii = (int*) hi;
printf("%d", *hii);
ah im an idiot!
I would need a & infront of the number aswell.
Any way to get ptr to a constant? (2189672) without making another ptr variable?
...
My recv function hangs while getting reponse from server.
Client side code in c/c++:
void sockStuff() {
int sock, bytes_recieved,bytes_send;
char send_data[1024], recv_data[4096];
struct hostent *host;
struct sockaddr_in server_addr;
host = gethostbyname("127.0.0.1");
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
pe...
I want to open a text file into some text editor say notepad programmatically in c/c++.
Also i want to see real time updation of text into that text file while opening in a editor.
Please suggest.
...
I am trying to retrieve the background and text color of the taskbar and/or my applications main window. It turned out, that Windows 7 does not return the correct colors. If i i.e. switch to a pink theme, Windows 7 still returns light blue for window caption although thats not true. This happens using
GetSysColor(COLOR_ACTIVECAPTION);
...
When defining a callback proc in Xt (for example XtTimerCallbackProc), client_data is specified as an XtPointer. Is it safe to pass an int via client_data, rather than an actual pointer, and cast it back inside the procedure?
For example:
void foo(void) {
...
int data = 1;
XtAppAddTimeout(app_context, 1000, timer_cb, data);
...
How can I get a list of the names of all currently running processes? (In C/Objective-C on Mac OS X.)
...
I want to read the output of my child's proccess, but for some reason it stops setting the POLLIN in revents when there is still output to be read.
Here is what I do:
Fork my process
create pipe
dup2(pipe[0],STDOUT_FILENO) my child's stdout
poll the file descriptor of the pipe(I do this until I reach EOF)
read output if POLLIN is se...