Author: ekohl
Date: Wed Mar 8 22:22:21 2017
New Revision: 74131
URL:
http://svn.reactos.org/svn/reactos?rev=74131&view=rev
Log:
[SHUTDOWN]
shutdown -t causes crash
Patch by Michael Fritscher.
CORE-12886 #resolve #comment Thanks a lot!
Modified:
trunk/reactos/base/applications/shutdown/shutdown.c
Modified: trunk/reactos/base/applications/shutdown/shutdown.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/shutdown…
==============================================================================
--- trunk/reactos/base/applications/shutdown/shutdown.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/shutdown/shutdown.c [iso-8859-1] Wed Mar 8 22:22:21
2017
@@ -56,12 +56,11 @@
break;
case L'c': /* Comment on reason for shutdown */
+ if (index+1 > argc)
+ return ERROR_INVALID_DATA;
if(CheckCommentLength(argv[index+1]))
{
- if (index+1 <= argc)
- pOpts->message = argv[index+1];
- else
- return ERROR_INVALID_DATA;
+ pOpts->message = argv[index+1];
index++;
}
else
@@ -72,10 +71,9 @@
break;
case L'd': /* Reason code [p|u:]xx:yy */
- if (index+1 <= argc)
- pOpts->reason = ParseReasonCode(argv[index+1]);
- else
+ if (index+1 >= argc)
return ERROR_INVALID_DATA;
+ pOpts->reason = ParseReasonCode(argv[index+1]);
index++;
break;
@@ -101,7 +99,10 @@
break;
case L'm': /* Target remote systems (UNC name/IP address) */
+ if (index+1 >= argc)
+ return ERROR_INVALID_DATA;
pOpts->remote_system = argv[index+1];
+ index++;
break;
case L'p': /* Turn off local computer with no warning/time-out
*/
@@ -118,9 +119,12 @@
break;
case L't': /* Shutdown delay */
+ if (index+1 >= argc)
+ return ERROR_INVALID_DATA;
pOpts->shutdown_delay = _wtoi(argv[index+1]);
if (pOpts->shutdown_delay > 0)
pOpts->force = TRUE;
+ index++;
break;
default: