diff mbox

[STABLE] Fix corner case in chardev udp: parameter

Message ID 4B50CAEA.6070900@web.de
State New
Headers show

Commit Message

Jan Kiszka Jan. 15, 2010, 8:07 p.m. UTC
The missing '@' broke 'udp::<port>@:<port>' parsing.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

 qemu-char.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Gerd Hoffmann Jan. 18, 2010, 9:24 a.m. UTC | #1
On 01/15/10 21:07, Jan Kiszka wrote:
> The missing '@' broke 'udp::<port>@:<port>' parsing.

>           if (sscanf(p, "%64[^:]:%32[^@,]%n", host, port,&pos)<  2) {
>               host[0] = 0;
> -            if (sscanf(p, ":%32[^,]%n", port,&pos)<  1) {
> +            if (sscanf(p, ":%32[^@,]%n", port,&pos)<  1) {

Indeed.

>                   fprintf(stderr, "udp #1\n");

While you are at it, can you also zap this debug leftover?

thanks,
   Gerd
Jan Kiszka Jan. 18, 2010, 10:21 a.m. UTC | #2
Gerd Hoffmann wrote:
> On 01/15/10 21:07, Jan Kiszka wrote:
>> The missing '@' broke 'udp::<port>@:<port>' parsing.
> 
>>           if (sscanf(p, "%64[^:]:%32[^@,]%n", host, port,&pos)<  2) {
>>               host[0] = 0;
>> -            if (sscanf(p, ":%32[^,]%n", port,&pos)<  1) {
>> +            if (sscanf(p, ":%32[^@,]%n", port,&pos)<  1) {
> 
> Indeed.
> 
>>                   fprintf(stderr, "udp #1\n");
> 
> While you are at it, can you also zap this debug leftover?

Looks like there are three of them in qemu_chr_parse_compat - kill them all?

Jan
Gerd Hoffmann Jan. 18, 2010, 10:47 a.m. UTC | #3
On 01/18/10 11:21, Jan Kiszka wrote:
> Gerd Hoffmann wrote:
>> On 01/15/10 21:07, Jan Kiszka wrote:
>>> The missing '@' broke 'udp::<port>@:<port>' parsing.
>>
>>>            if (sscanf(p, "%64[^:]:%32[^@,]%n", host, port,&pos)<   2) {
>>>                host[0] = 0;
>>> -            if (sscanf(p, ":%32[^,]%n", port,&pos)<   1) {
>>> +            if (sscanf(p, ":%32[^@,]%n", port,&pos)<   1) {
>>
>> Indeed.
>>
>>>                    fprintf(stderr, "udp #1\n");
>>
>> While you are at it, can you also zap this debug leftover?
>
> Looks like there are three of them in qemu_chr_parse_compat - kill them all?

Yes.

thanks,
   Gerd
diff mbox

Patch

diff --git a/qemu-char.c b/qemu-char.c
index b13f8d4..a8a92f5 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2314,7 +2314,7 @@  QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename)
         qemu_opt_set(opts, "backend", "udp");
         if (sscanf(p, "%64[^:]:%32[^@,]%n", host, port, &pos) < 2) {
             host[0] = 0;
-            if (sscanf(p, ":%32[^,]%n", port, &pos) < 1) {
+            if (sscanf(p, ":%32[^@,]%n", port, &pos) < 1) {
                 fprintf(stderr, "udp #1\n");
                 goto fail;
             }