Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a66e25d

Browse files
committed
* Python/pythonmain.c: fatal error if can't alloc mem for -c
string
1 parent bfd5d75 commit a66e25d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Python/pythonmain.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ realmain(argc, argv)
7171
that look like options are left for the
7272
the command to interpret. */
7373
command = malloc(strlen(optarg) + 2);
74-
/* Ignore malloc errors this early... */
74+
if (command == NULL)
75+
fatal("not enough memory to copy -c argument");
7576
strcpy(command, optarg);
7677
strcat(command, "\n");
7778
break;

0 commit comments

Comments
 (0)