[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SIGSEGV, Segmentation fault.
From: |
Martin Pala |
Subject: |
Re: SIGSEGV, Segmentation fault. |
Date: |
Tue, 20 May 2003 21:44:46 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030430 Debian/1.3-5 |
This kind of error (i think it was the cause of problem) was in the
sources more then once - new patch which should generaly fix it
attached, please try it, Igor.
Thanks,
Martin
Martin wrote:
Hi Igor,
can you try attached patch?
Thanks,
Cheers,
Martin
----- Původní zpráva -----
Od: Igor Homyakov <address@hidden>
Datum: úterý, 20. května 2003 v 9:32 dop.
Předmět: SIGSEGV, Segmentation fault.
address@hidden monit-3.2]# gdb ./monit
GNU gdb ALT Linux (5.2.1-alt2)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU
General Public License, and you are
welcome to change it and/or distribute copies
of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.
Type "show warranty" for details.
This GDB was configured as "i586-alt-linux"...
(gdb) break do_default
Breakpoint 1 at 0x804f09c: file monitor.c,
line 496.
(gdb) run
Starting program:
/home/homyakov/RPM/BUILD/monit-3.2/monit
[New Thread 1024 (LWP 14649)]
[Switching to Thread 1024 (LWP 14649)]
Breakpoint 1, do_default () at monitor.c:496
496 if(Run.isdaemon) {
(gdb) n
498 if(do_wakeupcall()) {
(gdb) n
504 log("Starting %s daemon\n", prog);
(gdb) s
log (format=0x80619e0 "Starting %s daemon\n")
at log.c:116
116 ASSERT(format);
(gdb) s
118 va_start(ap,format);
(gdb) n
119 vsnprintf(msg, STRLEN, format, ap);
(gdb) n
122 if(! Run.dolog) goto nolog;
(gdb) n
124 if(Run.use_syslog) {
(gdb) n
126 syslog(LOG_ERR|LOG_USER, "%s", msg);
(gdb) print msg
$1 = "Starting monit
daemon\n\0*???\177t?\004\bH5\a\b\220??\177\210??\177;?\004\b/var/run/address@hidden(??\177uC\005\bH5\a\b\0\0\0\0(??\177L\214?*L\214?*`\234?*"...(gdb)
n
Program received signal SIGSEGV, Segmentation
fault.0x2ac6011a in malloc () from
/lib/libc.so.6(gdb) where
#0 0x2ac6011a in malloc () from /lib/libc.so.6
#1 0x2ac5fc7e in malloc () from /lib/libc.so.6
#2 0x2ac57997 in open_memstream () from
/lib/libc.so.6#3 0x2acb90a9 in vsyslog ()
from /lib/libc.so.6
#4 0x2acb8ebd in syslog () from /lib/libc.so.6
#5 0x0804d4f5 in log (format=0x80619e0
"Starting %s daemon\n") at log.c:126
#6 0x0804f0cf in do_default () at monitor.c:504
#7 0x0804ec5d in do_action (args=0x7ffff8f4)
at monitor.c:316
#8 0x0804e917 in main (argc=1,
argv=0x7ffff8f4) at monitor.c:96
#9 0x2ac0b652 in __libc_start_main () from
/lib/libc.so.6
--
Igor Homyakov
<homyakov AT ramax.spb.ru>
--
To unsubscribe:
http://mail.nongnu.org/mailman/listinfo/monit-
general
diff -Naur monit/CHANGES.txt monit.segv/CHANGES.txt
--- monit/CHANGES.txt 2003-03-11 07:10:24.000000000 +0100
+++ monit.segv/CHANGES.txt 2003-05-20 21:35:29.000000000 +0200
@@ -11,6 +11,8 @@
* Fixes of monit rc script and monit.spec
+* Fix possible SIGSEGV
+
Version 3.2
diff -Naur monit/files.c monit.segv/files.c
--- monit/files.c 2003-03-10 08:56:34.000000000 +0100
+++ monit.segv/files.c 2003-05-20 21:09:50.000000000 +0200
@@ -72,8 +72,8 @@
*/
void init_files() {
- char pidfile[STRLEN];
- char statefile[STRLEN];
+ char pidfile[STRLEN+1];
+ char statefile[STRLEN+1];
/* Check if the pidfile was already set during configfile parsing */
if(Run.pidfile == NULL) {
@@ -160,7 +160,7 @@
*/
char *find_rcfile() {
- char *rcfile= xmalloc(STRLEN);
+ char *rcfile= xmalloc(STRLEN+1);
snprintf(rcfile, STRLEN, "%s/.%s", Run.Env.home, MONITRC);
@@ -172,14 +172,14 @@
if(exist_file(MONITRC)) {
- memset(rcfile, 0, STRLEN);
+ memset(rcfile, 0, STRLEN+1);
snprintf(rcfile, STRLEN, "%s/%s", Run.Env.cwd, MONITRC);
return (rcfile);
}
- memset(rcfile, 0, STRLEN);
+ memset(rcfile, 0, STRLEN+1);
snprintf(rcfile, STRLEN, "/etc/%s", MONITRC);
if(exist_file(rcfile))
diff -Naur monit/http/processor.c monit.segv/http/processor.c
--- monit/http/processor.c 2003-02-11 22:27:40.000000000 +0100
+++ monit.segv/http/processor.c 2003-05-20 21:26:09.000000000 +0200
@@ -222,7 +222,7 @@
ssize_t need= 0;
ssize_t have= 0;
int size= RES_STRLEN;
- char *string= xmalloc(size);
+ char *string= xmalloc(size+1);
va_list ap;
/* Ripped from the Linux vsnprintf man page */
@@ -248,7 +248,7 @@
}
- string= xresize(string, size);
+ string= xresize(string, size+1);
}
@@ -560,7 +560,7 @@
case SC_USE_PROXY:
return xstrdup("Use Proxy");
default: {
- char buf[STRLEN];
+ char buf[STRLEN+1];
snprintf(buf, STRLEN, "HTTP Response Status %d", status);
return xstrdup(buf);
}
@@ -628,14 +628,14 @@
*/
static char *get_date() {
- char date[STRLEN];
+ char date[STRLEN+1];
time_t now;
time(&now);
if ( !strftime(date, STRLEN, DATEFMT, gmtime(&now)) ) {
- memset(date, 0, STRLEN);
+ memset(date, 0, STRLEN+1);
}
@@ -649,7 +649,7 @@
*/
static char *get_server() {
- char server[STRLEN];
+ char server[STRLEN+1];
snprintf(server, STRLEN, "%s %s", SERVER_NAME, SERVER_VERSION);
return xstrdup(server);
@@ -1111,7 +1111,7 @@
if ( decode_base64(cr, strchr(credentials, ' ')) ) {
- char buf[STRLEN];
+ char buf[STRLEN+1];
snprintf(buf, STRLEN, "%s:%s", Run.Auth.uname, Run.Auth.passwd);
@@ -1143,7 +1143,7 @@
*/
static void internal_error(int client, int status, char *msg) {
- char response[RES_STRLEN];
+ char response[RES_STRLEN+1];
char *server= get_server();
char *date= get_date();
char *status_msg= get_status_string(status);
@@ -1170,7 +1170,7 @@
static void internal_error_ssl(ssl_connection *ssl, int status, char *msg) {
- char response[RES_STRLEN];
+ char response[RES_STRLEN+1];
char *server= get_server();
char *date= get_date();
char *status_msg= get_status_string(status);
diff -Naur monit/log.c monit.segv/log.c
--- monit/log.c 2003-02-11 22:27:39.000000000 +0100
+++ monit.segv/log.c 2003-05-20 21:10:15.000000000 +0200
@@ -54,7 +54,7 @@
/* Private variables */
static FILE *LOG= NULL;
-static char time_str[STRLEN];
+static char time_str[STRLEN+1];
/* Private prototypes */
static int open_log();
@@ -110,7 +110,7 @@
*/
void log(const char *format, ...) {
- char msg[STRLEN];
+ char msg[STRLEN+1];
va_list ap;
ASSERT(format);
@@ -220,7 +220,7 @@
time(&now);
if(!strftime(time_str, STRLEN, TIMEFORMAT, localtime(&now))) {
- memset(time_str, 0, STRLEN);
+ memset(time_str, 0, STRLEN+1);
}
diff -Naur monit/process/common.c monit.segv/process/common.c
--- monit/process/common.c 2003-02-11 22:27:40.000000000 +0100
+++ monit.segv/process/common.c 2003-05-20 21:27:28.000000000 +0200
@@ -76,7 +76,7 @@
int read_proc_file(char *buf, int buf_size, char * name, int pid) {
int fd;
- char filename[STRLEN];
+ char filename[STRLEN+1];
int bytes;
ASSERT(buf);
diff -Naur monit/protocols/dwp.c monit.segv/protocols/dwp.c
--- monit/protocols/dwp.c 2003-02-14 19:44:59.000000000 +0100
+++ monit.segv/protocols/dwp.c 2003-05-20 21:28:32.000000000 +0200
@@ -68,7 +68,7 @@
int status;
char buf[STRLEN];
char proto[STRLEN];
- char request[REQ_LENGTH];
+ char request[REQ_LENGTH+1];
ASSERT(p);
diff -Naur monit/protocols/http.c monit.segv/protocols/http.c
--- monit/protocols/http.c 2003-02-14 19:44:59.000000000 +0100
+++ monit.segv/protocols/http.c 2003-05-20 21:30:07.000000000 +0200
@@ -75,9 +75,9 @@
int status;
char buf[STRLEN];
char msg[STRLEN];
- char host[STRLEN];
+ char host[STRLEN+1];
char proto[STRLEN];
- char request[REQ_LENGTH];
+ char request[REQ_LENGTH+1];
ASSERT(p);
diff -Naur monit/spawn.c monit.segv/spawn.c
--- monit/spawn.c 2003-03-05 20:28:03.000000000 +0100
+++ monit.segv/spawn.c 2003-05-20 21:10:52.000000000 +0200
@@ -238,7 +238,7 @@
if(h->alert_on_restart) {
Mail_T n= NEW(n);
- char *message= xmalloc(STRLEN);
+ char *message= xmalloc(STRLEN+1);
n->to= xstrdup(h->to);
n->from= xstrdup("address@hidden");
diff -Naur monit/ssl.c monit.segv/ssl.c
--- monit/ssl.c 2003-02-11 22:27:39.000000000 +0100
+++ monit.segv/ssl.c 2003-05-20 21:12:21.000000000 +0200
@@ -1296,7 +1296,7 @@
#ifdef HAVE_OPENSSL
- char msg[STRLEN];
+ char msg[STRLEN+1];
int len;
va_list ap;
@@ -1708,7 +1708,7 @@
*/
static int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) {
- char subject[STRLEN];
+ char subject[STRLEN+1];
X509_OBJECT found_cert;
X509_NAME_oneline(X509_get_subject_name(ctx->current_cert), subject, STRLEN);
@@ -1749,7 +1749,7 @@
static int verify_callback_noclientcert(int preverify_ok,
X509_STORE_CTX *ctx) {
- char subject[STRLEN];
+ char subject[STRLEN+1];
X509_NAME_oneline(X509_get_subject_name(ctx->current_cert), subject, STRLEN);
diff -Naur monit/state.c monit.segv/state.c
--- monit/state.c 2003-04-25 19:37:27.000000000 +0200
+++ monit.segv/state.c 2003-05-20 21:13:02.000000000 +0200
@@ -64,7 +64,7 @@
* when handling the state.
*/
typedef struct mystate {
- char name[STRLEN];
+ char name[STRLEN+1];
int mode;
int nstart;
int ncycle;
diff -Naur monit/status.c monit.segv/status.c
--- monit/status.c 2003-02-13 15:48:31.000000000 +0100
+++ monit.segv/status.c 2003-05-20 21:15:38.000000000 +0200
@@ -207,9 +207,9 @@
} else {
int n;
- char req[2*STRLEN];
+ char req[2*STRLEN+1];
char *auth= get_basic_authentication_header();
- char buf[STRLEN];
+ char buf[STRLEN+1];
snprintf(req, 2*STRLEN,
"GET /%s?action=status HTTP/1.0\r\n%s\r\n", p->name, auth);
diff -Naur monit/util.c monit.segv/util.c
--- monit/util.c 2003-03-05 20:28:03.000000000 +0100
+++ monit.segv/util.c 2003-05-20 21:17:19.000000000 +0200
@@ -787,7 +787,7 @@
char *get_ctime() {
time_t now;
- char *buf = (char*)xmalloc(STRLEN);
+ char *buf = (char*)xmalloc(STRLEN+1);
time(&now);
snprintf(buf, STRLEN, "%s", ctime(&now));
@@ -1002,7 +1002,7 @@
if(Run.Auth.defined) {
char *b64;
- char buf[STRLEN];
+ char buf[STRLEN+1];
char *auth= xmalloc(STRLEN+1);
snprintf(buf, STRLEN, "%s:%s", Run.Auth.uname, Run.Auth.passwd);
@@ -1029,7 +1029,7 @@
int n;
int size= STRLEN;
- char *buf= xmalloc(size);
+ char *buf= xmalloc(size+1);
ASSERT(s);
diff -Naur monit/validate.c monit.segv/validate.c
--- monit/validate.c 2003-02-18 21:16:12.000000000 +0100
+++ monit.segv/validate.c 2003-05-20 21:01:15.000000000 +0200
@@ -126,7 +126,7 @@
Timestamp_T tl;
pid_t pid= -1;
sigset_t ns,os;
- char report[STRLEN];
+ char report[STRLEN+1];
ASSERT(p);
- SIGSEGV, Segmentation fault., Igor Homyakov, 2003/05/20
- Re: SIGSEGV, Segmentation fault., Martin, 2003/05/20
- Re: SIGSEGV, Segmentation fault.,
Martin Pala <=
- RE: SIGSEGV, Segmentation fault., Jan-Henrik Haukeland, 2003/05/20
- Re: SIGSEGV, Segmentation fault., Igor Homyakov, 2003/05/21
- Re: SIGSEGV, Segmentation fault., Igor Homyakov, 2003/05/21
- RE: SIGSEGV, Segmentation fault., Jan-Henrik Haukeland, 2003/05/21
- Re: SIGSEGV, Segmentation fault., Martin Pala, 2003/05/22
- Re: SIGSEGV, Segmentation fault., Igor Homyakov, 2003/05/23
- Re: SIGSEGV, Segmentation fault., Igor Homyakov, 2003/05/21
- RE: SIGSEGV, Segmentation fault., Jan-Henrik Haukeland, 2003/05/21
- Re: SIGSEGV, Segmentation fault., Igor Homyakov, 2003/05/22
- Re: SIGSEGV, Segmentation fault., Jan-Henrik Haukeland, 2003/05/23