Subject: Re: bus Error (core dump) when runing BitchX
To: Luc Martineau <lpmartineau@yahoo.com>
From: john heasley <heas@shrubbery.net>
List: port-sparc64
Date: 10/27/2004 16:46:51
Wed, Oct 27, 2004 at 06:45:41PM -0400, Luc Martineau:
> 
> Hello,
> 
> in order to get the Core dump this is what happens...
> cd /usr/pkg/bin/
> ./BitchX-1.0c19
> 
> it opens BitchX and connects to irc.prison.net (I
> tried multiple servers)
> it logs onto the server, works GREAT, 
> I can do /whois mynick and it coms up fine
> I can do lists ETC it all works
> 
> when I join a channel is where I get the problem...
> *** luma_
> [~luma@CPE00503ee3ffe1-CM0011aea1c0c2.cpe.net.cable.rogers.com]
> has   
>           joined #luma                                
>                          

this package is a LP64 disaster.
This replacement for patch-al hacks that particular problem (though i
do not believe it is complete).  Last I checked, bitchx was no longer
maintained; better off using something else and marking this not for
sparc64 (or amd64?).

--- source/numbers.c.orig	2002-02-28 04:22:50.000000000 +0000
+++ source/numbers.c
@@ -354,26 +354,29 @@ static	void cannot_join_channel(char *fr
 
 	set_display_target(chan, LOG_CURRENT);
 	PasteArgs(ArgList, 0);
-	strcpy(buffer, ArgList[0]);
+	strlcpy(buffer, ArgList[0], sizeof buffer);
 	switch(-current_numeric)
 	{
 		case 437: 
-			strcat(buffer, " (Channel is temporarily unavailable)");
+			strlcat(buffer, 
+				" (Channel is temporarily unavailable)",
+				sizeof buffer);
 			break;
 		case 471:
-			strcat(buffer, " (Channel is full)");
+			strlcat(buffer, " (Channel is full)", sizeof buffer);
 			break;
 		case 473:
-			strcat(buffer, " (You must be invited)");
+			strlcat(buffer, " (You must be invited)", 
+				sizeof buffer);
 			break;
 		case 474:
-			strcat(buffer, " (You are banned)");
+			strlcat(buffer, " (You are banned)", sizeof buffer);
 			break;
 		case 475:
-			strcat(buffer, " (Bad channel key)");
+			strlcat(buffer, " (Bad channel key)", sizeof buffer);
 			break;
 		case 476:
-			strcat(buffer, " (Bad channel mask)");
+			strlcat(buffer, " (Bad channel mask)", sizeof buffer);
 			break;
 		default:
 			return;
@@ -385,7 +388,6 @@ static	void cannot_join_channel(char *fr
 	reset_display_target();
 }
 
-
 int handle_server_stats(char *from, char **ArgList, int comm)
 {
 static	int 	norm = 0, 
@@ -927,9 +929,10 @@ void numbered_command(char *from, int co
 		if (ArgList[2])
 		{
 			time_t tme = (time_t) my_atol(ArgList[3]);
+			long utme = tme;
 			if (do_hook(current_numeric, "%s %s %s %s %s", 
 				from, ArgList[0], ArgList[1], ArgList[2], ArgList[3]))
-				put_it("%s", convert_output_format(fget_string_var(FORMAT_BANS_FSET), "%d %s %s %s %l", number_of_exempts, ArgList[0], ArgList[1], ArgList[2], tme));
+				put_it("%s", convert_output_format(fget_string_var(FORMAT_BANS_FSET), "%d %s %s %s %l", number_of_exempts, ArgList[0], ArgList[1], ArgList[2], utme));
 		}
 		else
 			if (do_hook(current_numeric, "%s %s %s", from, ArgList[0], ArgList[1]))
@@ -1179,9 +1182,10 @@ void numbered_command(char *from, int co
 		if (ArgList[2])
 		{
 			time_t tme = (time_t) my_atol(ArgList[3]);
+			long utme = tme;
 			if (do_hook(current_numeric, "%s %s %s %s %s", 
 				from, ArgList[0], ArgList[1], ArgList[2], ArgList[3]))
-				put_it("%s", convert_output_format(fget_string_var(FORMAT_BANS_FSET), "%d %s %s %s %l", number_of_bans, ArgList[0], ArgList[1], ArgList[2], tme));
+				put_it("%s", convert_output_format(fget_string_var(FORMAT_BANS_FSET), "%d %s %s %s %l", number_of_bans, ArgList[0], ArgList[1], ArgList[2], utme));
 		}
 		else
 			if (do_hook(current_numeric, "%s %s %s", from, ArgList[0], ArgList[1]))
@@ -1456,12 +1460,13 @@ void numbered_command(char *from, int co
 		case 329:		/* #define CREATION_TIME	329 */
 		{
 			time_t tme;
+			long utme = tme;
 			char this_sucks[80];
 			ChannelList *chan = NULL;
 			
 			if (!ArgList[1] || !*ArgList[1])
 				break;
-			sscanf(ArgList[1], "%lu", &tme);
+			sscanf(ArgList[1], "%lu", &utme);
 			strcpy(this_sucks, ctime(&tme));
 			this_sucks[strlen(this_sucks)-1] = '\0';		
 
@@ -1472,16 +1477,16 @@ void numbered_command(char *from, int co
 			else
 			{
 				char cts[80], pts[80], ots[80];
-				sscanf(ArgList[2], "%lu", &tme);
-				strcpy(cts, ctime(&tme));
+				sscanf(ArgList[2], "%lu", &utme);
+				strcpy(cts, ctime(&utme));
 				cts[strlen(cts)-1] = '\0';		
-				sscanf(ArgList[2], "%lu", &tme);
+				sscanf(ArgList[2], "%lu", &utme);
 				strcpy(pts, ctime(&tme));
 				pts[strlen(pts)-1] = '\0';		
 				ots[0] = 0;
 				if (ArgList[3])
 				{
-					sscanf(ArgList[3], "%lu", &tme);
+					sscanf(ArgList[3], "%lu", &utme);
 					strcpy(ots, ctime(&tme));
 				}
 				ots[strlen(ots)-1] = '\0';		
@@ -1491,7 +1496,7 @@ void numbered_command(char *from, int co
 					ArgList[0], cts, pts, ots);
 			}
 			if ((chan = lookup_channel(ArgList[0], from_server, 0)))
-				chan->channel_create.tv_sec = tme;
+				chan->channel_create.tv_sec = utme;
 			reset_display_target();
 			break;
 		}