[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#196431: axel crashes on long urls



tags 196431 +patch
thanks

On 07/09/14 15:55 +0530, Y Giridhar Appaji Nag said ...
> Axel currently cannot handle strings of length over 256 (MAX_STRING in
> axel.h) and should exit gracefully.  Fix forthcoming.

Attached patch ...

1. Exits if the URL is over MAX_STRING in length
2. Increases MAX_STRING to 1024 from 256 to be more useful :)

Giridhar

-- 
Y Giridhar Appaji Nag | http://www.appaji.net/
diff -Nur original/axel-1.0b/axel.h axel-1.0b/axel.h
--- original/axel-1.0b/axel.h	2002-05-03 18:15:18.000000000 +0530
+++ axel-1.0b/axel.h	2007-11-06 12:46:50.600754000 +0530
@@ -64,7 +64,7 @@
 #endif
 
 /* Compiled-in settings							*/
-#define MAX_STRING		256
+#define MAX_STRING		1024
 #define MAX_REDIR		5
 #define AXEL_VERSION_STRING	"1.0b"
 #define USER_AGENT		"Axel " AXEL_VERSION_STRING " (" ARCH ")"
diff -Nur original/axel-1.0b/text.c axel-1.0b/text.c
--- original/axel-1.0b/text.c	2002-02-20 01:15:55.000000000 +0530
+++ axel-1.0b/text.c	2007-11-06 12:52:54.054674000 +0530
@@ -164,11 +164,16 @@
 	else if( strcmp( argv[optind], "-" ) == 0 )
 	{
 		s = malloc( MAX_STRING );
-		scanf( "%127[^\n]s", s );
+		scanf( "%1024[^\n]s", s );
 	}
 	else
 	{
 		s = argv[optind];
+		if( strlen( s ) > MAX_STRING )
+		{
+			fprintf( stderr, _("Can't handle URLs of length over %d\n" ), MAX_STRING );
+			return( 1 );
+		}
 	}
 	
 	printf( _("Initializing download: %s\n"), s );

Attachment: signature.asc
Description: Digital signature


Reply to: