All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4.9 and older] cmdline: fix parse_boolean() for NULL incoming end pointer
@ 2018-07-16  8:50 Jan Beulich
  2018-07-16 10:03 ` Andrew Cooper
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2018-07-16  8:50 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Wei Liu, George Dunlap, Andrew Cooper,
	Ian Jackson, Tim Deegan, Julien Grall

Use the calculated lengths instead of pointers, as 'e' being NULL will
otherwise cause undue parsing failures.

Reported-by: Karl Johnson <karljohnson.it@gmail.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -209,10 +209,11 @@ int parse_boolean(const char *name, cons
         char buf[8];
 
         s += nlen + 1;
-        if ( e <= s || e - s >= ARRAY_SIZE(buf) )
+        slen -= nlen + 1;
+        if ( slen >= ARRAY_SIZE(buf) )
             return -1;
-        memcpy(buf, s, e - s);
-        buf[e - s] = 0;
+        memcpy(buf, s, slen);
+        buf[slen] = 0;
         return parse_bool(buf);
     }
 



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 4.9 and older] cmdline: fix parse_boolean() for NULL incoming end pointer
  2018-07-16  8:50 [PATCH 4.9 and older] cmdline: fix parse_boolean() for NULL incoming end pointer Jan Beulich
@ 2018-07-16 10:03 ` Andrew Cooper
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cooper @ 2018-07-16 10:03 UTC (permalink / raw)
  To: Jan Beulich, xen-devel
  Cc: Stefano Stabellini, Wei Liu, George Dunlap, Tim Deegan,
	Ian Jackson, Julien Grall

On 16/07/18 09:50, Jan Beulich wrote:
> Use the calculated lengths instead of pointers, as 'e' being NULL will
> otherwise cause undue parsing failures.
>
> Reported-by: Karl Johnson <karljohnson.it@gmail.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-16 10:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-16  8:50 [PATCH 4.9 and older] cmdline: fix parse_boolean() for NULL incoming end pointer Jan Beulich
2018-07-16 10:03 ` Andrew Cooper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.