474a44
commit 6b93714b83d59ae4147b8ec3887261aca7fd6f65
474a44
Author: Dave Anderson <anderson@redhat.com>
474a44
Date:   Mon Jan 7 10:44:29 2019 -0500
474a44
474a44
    Prevent a SIGSEGV if a user attempts to input a command line that
474a44
    exceeds the maximum length of 1500 bytes.  The patch displays an
474a44
    error message and ignores the command line.
474a44
    (anderson@redhat.com)
474a44
474a44
diff --git a/cmdline.c b/cmdline.c
474a44
index 665f48c..796f7c5 100644
474a44
--- a/cmdline.c
474a44
+++ b/cmdline.c
474a44
@@ -1,8 +1,8 @@
474a44
 /* cmdline.c - core analysis suite
474a44
  *
474a44
  * Copyright (C) 1999, 2000, 2001, 2002 Mission Critical Linux, Inc.
474a44
- * Copyright (C) 2002-2015,2017 David Anderson
474a44
- * Copyright (C) 2002-2015,2017 Red Hat, Inc. All rights reserved.
474a44
+ * Copyright (C) 2002-2015,2019 David Anderson
474a44
+ * Copyright (C) 2002-2015,2019 Red Hat, Inc. All rights reserved.
474a44
  *
474a44
  * This program is free software; you can redistribute it and/or modify
474a44
  * it under the terms of the GNU General Public License as published by
474a44
@@ -121,9 +121,11 @@ process_command_line(void)
474a44
 			args[0] = NULL;
474a44
 			fprintf(fp, "\n");
474a44
 			return;
474a44
-		} 
474a44
-
474a44
-		strcpy(pc->command_line, pc->readline);
474a44
+		}
474a44
+		if (strlen(pc->readline) >= BUFSIZE)
474a44
+			error(FATAL, "input line exceeds maximum of 1500 bytes\n");	
474a44
+		else	
474a44
+			strcpy(pc->command_line, pc->readline);
474a44
 		free(pc->readline); 
474a44
 
474a44
 		clean_line(pc->command_line);