[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] qemu-socket: allow hostnames starting with
From: |
Ján Tomko |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] qemu-socket: allow hostnames starting with a digit |
Date: |
Tue, 18 Jun 2013 13:29:31 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130521 Thunderbird/17.0.6 |
On 06/18/2013 11:42 AM, Paolo Bonzini wrote:
> Il 03/06/2013 17:54, Ján Tomko ha scritto:
>> According to RFC 1123 [1], hostnames can start with a digit too.
>>
>> [1] http://tools.ietf.org/html/rfc1123#page-13
>>
>> Signed-off-by: Ján Tomko <address@hidden>
>> ---
>> } else {
>> - /* hostname */
>> + /* hostname or IPv4 addr */
>> if (2 != sscanf(str, "%64[^:]:%32[^,]%n", host, port, &pos)) {
>> error_setg(errp, "error parsing address '%s'", str);
>> goto fail;
>> }
>> + if (strcspn(host, "0123456789.") == 0) {
>
> I think what you want here is:
>
> if (host[strspn(host, "0123456789.")] == '\0') {
>
Yes, thank you for catching that.
Jan
> Otherwise, you're still basically testing
>
> qemu_isdigit(str[0]) || str[0] == '.'
>
> Paolo
>
>> + addr->ipv4 = addr->has_ipv4 = true;
>> + }
>> }
>>
>> addr->host = g_strdup(host);
>>
>
>