Index: UefiShellLib.c
===================================================================
--- UefiShellLib.c	(revision 17580)
+++ UefiShellLib.c	(working copy)
@@ -3785,10 +3785,10 @@
   Result = 0;
 
   //
-  // Skip spaces if requested
+  // there is a space where there should't be
   //
-  while (StopAtSpace && *String == L' ') {
-    String++;
+  if (*String == L' ') {
+    return (EFI_INVALID_PARAMETER);
   }
 
   while (ShellIsHexaDecimalDigitCharacter (*String)) {
@@ -3877,11 +3877,13 @@
   Result = 0;
 
   //
-  // Skip spaces if requested
+  // Stop upon space if requested 
+  // (if the whole value was 0)
   //
-  while (StopAtSpace && *String == L' ') {
-    String++;
+  if (StopAtSpace && *String == L' ') {
+    return (EFI_SUCCESS);
   }
+
   while (ShellIsDecimalDigitCharacter (*String)) {
     //
     // If the number represented by String overflows according
