* [PATCH] xl: tighten parsing of "irq" and "iomem" list elements
@ 2015-09-14 13:53 Jan Beulich
2015-09-15 9:09 ` Dario Faggioli
2015-09-15 9:32 ` Ian Campbell
0 siblings, 2 replies; 4+ messages in thread
From: Jan Beulich @ 2015-09-14 13:53 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Campbell, Ian Jackson, Wei Liu, Stefano Stabellini
[-- Attachment #1: Type: text/plain, Size: 1692 bytes --]
While "ioport" list element parsing already validates that the entire
input string got consumed, its two siblings so far didn't.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1730,7 +1730,7 @@ static void parse_config_data(const char
exit(1);
}
ul = strtoul(buf, &ep, 10);
- if (ep == buf) {
+ if (ep == buf || *ep != '\0') {
fprintf(stderr,
"xl: Invalid argument parsing irq: %s\n", buf);
exit(1);
@@ -1752,6 +1752,8 @@ static void parse_config_data(const char
exit(-1);
}
for (i = 0; i < num_iomem; i++) {
+ int used;
+
buf = xlu_cfg_get_listitem (iomem, i);
if (!buf) {
fprintf(stderr,
@@ -1759,11 +1761,11 @@ static void parse_config_data(const char
exit(1);
}
libxl_iomem_range_init(&b_info->iomem[i]);
- ret = sscanf(buf, "%" SCNx64",%" SCNx64"@%" SCNx64,
+ ret = sscanf(buf, "%" SCNx64",%" SCNx64"%n@%" SCNx64"%n",
&b_info->iomem[i].start,
- &b_info->iomem[i].number,
- &b_info->iomem[i].gfn);
- if (ret < 2) {
+ &b_info->iomem[i].number, &used,
+ &b_info->iomem[i].gfn, &used);
+ if (ret < 2 || buf[used] != '\0') {
fprintf(stderr,
"xl: Invalid argument parsing iomem: %s\n", buf);
exit(1);
[-- Attachment #2: xl-irq-iomem-parse.patch --]
[-- Type: text/plain, Size: 1744 bytes --]
xl: tighten parsing of "irq" and "iomem" list elements
While "ioport" list element parsing already validates that the entire
input string got consumed, its two siblings so far didn't.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -1730,7 +1730,7 @@ static void parse_config_data(const char
exit(1);
}
ul = strtoul(buf, &ep, 10);
- if (ep == buf) {
+ if (ep == buf || *ep != '\0') {
fprintf(stderr,
"xl: Invalid argument parsing irq: %s\n", buf);
exit(1);
@@ -1752,6 +1752,8 @@ static void parse_config_data(const char
exit(-1);
}
for (i = 0; i < num_iomem; i++) {
+ int used;
+
buf = xlu_cfg_get_listitem (iomem, i);
if (!buf) {
fprintf(stderr,
@@ -1759,11 +1761,11 @@ static void parse_config_data(const char
exit(1);
}
libxl_iomem_range_init(&b_info->iomem[i]);
- ret = sscanf(buf, "%" SCNx64",%" SCNx64"@%" SCNx64,
+ ret = sscanf(buf, "%" SCNx64",%" SCNx64"%n@%" SCNx64"%n",
&b_info->iomem[i].start,
- &b_info->iomem[i].number,
- &b_info->iomem[i].gfn);
- if (ret < 2) {
+ &b_info->iomem[i].number, &used,
+ &b_info->iomem[i].gfn, &used);
+ if (ret < 2 || buf[used] != '\0') {
fprintf(stderr,
"xl: Invalid argument parsing iomem: %s\n", buf);
exit(1);
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xl: tighten parsing of "irq" and "iomem" list elements
2015-09-14 13:53 [PATCH] xl: tighten parsing of "irq" and "iomem" list elements Jan Beulich
@ 2015-09-15 9:09 ` Dario Faggioli
2015-09-15 11:16 ` Ian Campbell
2015-09-15 9:32 ` Ian Campbell
1 sibling, 1 reply; 4+ messages in thread
From: Dario Faggioli @ 2015-09-15 9:09 UTC (permalink / raw)
To: Jan Beulich
Cc: Ian Campbell, xen-devel, Ian Jackson, Wei Liu, Stefano Stabellini
[-- Attachment #1.1: Type: text/plain, Size: 584 bytes --]
On Mon, 2015-09-14 at 07:53 -0600, Jan Beulich wrote:
> While "ioport" list element parsing already validates that the entire
> input string got consumed, its two siblings so far didn't.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>
Regards,
Dario
--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xl: tighten parsing of "irq" and "iomem" list elements
2015-09-14 13:53 [PATCH] xl: tighten parsing of "irq" and "iomem" list elements Jan Beulich
2015-09-15 9:09 ` Dario Faggioli
@ 2015-09-15 9:32 ` Ian Campbell
1 sibling, 0 replies; 4+ messages in thread
From: Ian Campbell @ 2015-09-15 9:32 UTC (permalink / raw)
To: Jan Beulich, xen-devel; +Cc: Ian Jackson, Wei Liu, Stefano Stabellini
On Mon, 2015-09-14 at 07:53 -0600, Jan Beulich wrote:
> While "ioport" list element parsing already validates that the entire
> input string got consumed, its two siblings so far didn't.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xl: tighten parsing of "irq" and "iomem" list elements
2015-09-15 9:09 ` Dario Faggioli
@ 2015-09-15 11:16 ` Ian Campbell
0 siblings, 0 replies; 4+ messages in thread
From: Ian Campbell @ 2015-09-15 11:16 UTC (permalink / raw)
To: Dario Faggioli, Jan Beulich
Cc: xen-devel, Ian Jackson, Wei Liu, Stefano Stabellini
On Tue, 2015-09-15 at 11:09 +0200, Dario Faggioli wrote:
> On Mon, 2015-09-14 at 07:53 -0600, Jan Beulich wrote:
> > While "ioport" list element parsing already validates that the entire
> > input string got consumed, its two siblings so far didn't.
> >
> > Signed-off-by: Jan Beulich <jbeulich@suse.com>
> >
> Reviewed-by: Dario Faggioli <dario.faggioli@citrix.com>
Applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-09-15 11:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-14 13:53 [PATCH] xl: tighten parsing of "irq" and "iomem" list elements Jan Beulich
2015-09-15 9:09 ` Dario Faggioli
2015-09-15 11:16 ` Ian Campbell
2015-09-15 9:32 ` Ian Campbell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).