Sponsored Content
Full Discussion: buffer over flow detected
Top Forums Programming buffer over flow detected Post 302305589 by littleboyblu on Thursday 9th of April 2009 09:46:12 AM
Old 04-09-2009
buffer over flow detected

Hi,
my program stops with a buffer overflow error, but i can't understand the problem. I have a file like:

int array[n]; //global variable
void func(){
int i;
for(i=0;i<n;i++)array[i]=-1;
...
}
I had the error when i added the array initialization.
the file is a part of a C project. What buffer overflow is due to?
thanks
 

9 More Discussions You Might Find Interesting

1. Cybersecurity

Flow of Unix System

Hello, Is there a functional flow of the UNIX security system that I can view? (1 Reply)
Discussion started by: spanglerbrod
1 Replies

2. Programming

dilemma in control flow

hello im facing a queer problem when i execute the foll code in unix # include <stdio.h> # include <unistd.h> main(int argc,char *argv) { FILE *fp = fopen("/ras/chirag/fifotest/file.fifo","a"); int i=1; fprintf(fp,argv); printf("I SLEEP"); system("date"); for (i=0;i<50;i++)... (2 Replies)
Discussion started by: tej.buch
2 Replies

3. Programming

Flow Chart

Any One help how to draw the flow chart for C programe ? If any usefull link's. (1 Reply)
Discussion started by: sabari
1 Replies

4. UNIX for Advanced & Expert Users

Script should flow after ftp --Urgent

Hi everyone, The script actually does the ftp and gets the file to the local system. I want to do some manipulations for that file , But after doing ftp , script is not proceding and just a prompt is displayed . .... ftp code here...... .................... ............... echo "FTP... (4 Replies)
Discussion started by: kaaakrishna
4 Replies

5. Shell Programming and Scripting

Understanding Logic and Flow better

i am in an epic quagmire of horrid misunderstanding. its been a while since ive been in the scene, couldnt remember my login for the account i used to have here, so excuse the 1st post. i dont want it to seem like ima post n boogy. in any case here we go: just recently installed mandriva... (6 Replies)
Discussion started by: SirDonkeyPunch
6 Replies

6. Shell Programming and Scripting

Flow Control in CSH

hi , I am new to scripting, i have a doubt can any one pls solve it for me the code is not working set users = (user1 user2 user3) echo The users are echo $users echo Enter the USER NAME set USER_NAME = $< set i = 1; for ( i = 1; i <= $#users; i++ ) if ( $USER_NAME == $users )... (1 Reply)
Discussion started by: Manju87
1 Replies

7. Shell Programming and Scripting

Will this flow work

B() { } A() { calling a function B } for condition do calling a function A done Shall after executing function B, the control will return back to loop? Thanks in advance :) (2 Replies)
Discussion started by: ezee
2 Replies

8. Shell Programming and Scripting

Help with control flow in a Bash script

In my bash script I want to say "if argument 2 is anything except x, y or z, than echo this" (x y and z being words). So my script looks like this: if ] then echo "unrecognized input: $2" fi This usually works but than I also want to say "if argument 2 IS x, y, or z, but argument 4 is... (4 Replies)
Discussion started by: Jrodicon
4 Replies

9. Emergency UNIX and Linux Support

Port flow capture

I am trying to get an output using the command tcpdump -w /tmp/syn.pcap 'tcp & (tcp-syn) != 0' But I am getting the error: tcpdump: no suitable device found Is there an alternate command to achieve this? (4 Replies)
Discussion started by: ggayathri
4 Replies
explain_ferror(3)					     Library Functions Manual						 explain_ferror(3)

NAME
explain_ferror - explain ferror(3) errors SYNOPSIS
#include <libexplain/ferror.h> const char *explain_ferror(FILE *fp); const char *explain_errno_ferror(int errnum, FILE *fp); void explain_message_ferror(char *message, int message_size, FILE *fp); void explain_message_errno_ferror(char *message, int message_size, int errnum, FILE *fp); DESCRIPTION
These functions may be used to obtain explanations for errors returned by the ferror(3) system call. explain_ferror const char *explain_ferror(FILE *fp); The explain_ferror function is used to obtain an explanation of an error returned by the ferror(3) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. This function is intended to be used in a fashion similar to the following example: if (ferror(fp) < 0) { fprintf(stderr, "%s ", explain_ferror(fp)); exit(EXIT_FAILURE); } It is essential that this function cal be placed as close as possible to the I/O code that has caused the problem, otherwise intervening code could have altered the errno global variable. fp The original fp, exactly as passed to the ferror(3) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. explain_errno_ferror const char *explain_errno_ferror(int errnum, FILE *fp); The explain_errno_ferror function is used to obtain an explanation of an error returned by the ferror(3) system call. The least the mes- sage will contain is the value of strerror(errnum), but usually it will do much better, and indicate the underlying cause in more detail. This function is intended to be used in a fashion similar to the following example: if (ferror(fp) < 0) { int err = errno; fprintf(stderr, "%s ", explain_errno_ferror(err, fp)); exit(EXIT_FAILURE); } It is essential that this function cal be placed as close as possible to the I/O code that has caused the problem, otherwise intervening code could have altered the errno global variable. errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. fp The original fp, exactly as passed to the ferror(3) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. explain_message_ferror void explain_message_ferror(char *message, int message_size, FILE *fp); The explain_message_ferror function may be used to obtain an explanation of an error returned by the ferror(3) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. This function is intended to be used in a fashion similar to the following example: if (ferror(fp) < 0) { char message[3000]; explain_message_ferror(message, sizeof(message), fp); fprintf(stderr, "%s ", message); exit(EXIT_FAILURE); } It is essential that this function cal be placed as close as possible to the I/O code that has caused the problem, otherwise intervening code could have altered the errno global variable. message The location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. message_size The size in bytes of the location in which to store the returned message. fp The original fp, exactly as passed to the ferror(3) system call. explain_message_errno_ferror void explain_message_errno_ferror(char *message, int message_size, int errnum, FILE *fp); The explain_message_errno_ferror function may be used to obtain an explanation of an error returned by the ferror(3) system call. The least the message will contain is the value of strerror(errnum), but usually it will do much better, and indicate the underlying cause in more detail. This function is intended to be used in a fashion similar to the following example: if (ferror(fp) < 0) { int err = errno; char message[3000]; explain_message_errno_ferror(message, sizeof(message), err, fp); fprintf(stderr, "%s ", message); exit(EXIT_FAILURE); } It is essential that this function cal be placed as close as possible to the I/O code that has caused the problem, otherwise intervening code could have altered the errno global variable. message The location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. message_size The size in bytes of the location in which to store the returned message. errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. fp The original fp, exactly as passed to the ferror(3) system call. SEE ALSO
ferror(3) check stream status explain_ferror_or_die(3) check stream status and report errors COPYRIGHT
libexplain version 0.52 Copyright (C) 2008 Peter Miller explain_ferror(3)
All times are GMT -4. The time now is 08:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy