[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH for-2.9?] block/nfs: Do not strcmp(
From: |
Max Reitz |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH for-2.9?] block/nfs: Do not strcmp() with NULL |
Date: |
Tue, 11 Apr 2017 15:59:26 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 |
On 11.04.2017 15:58, Markus Armbruster wrote:
> Max Reitz <address@hidden> writes:
>
>> Parsing the URI is not required to give us a scheme; uri->scheme may be
>> NULL.
>>
>> Signed-off-by: Max Reitz <address@hidden>
>> ---
>> block/nfs.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/block/nfs.c b/block/nfs.c
>> index 0816678307..0c7d5619fe 100644
>> --- a/block/nfs.c
>> +++ b/block/nfs.c
>> @@ -83,7 +83,7 @@ static int nfs_parse_uri(const char *filename, QDict
>> *options, Error **errp)
>> error_setg(errp, "Invalid URI specified");
>> goto out;
>> }
>> - if (strcmp(uri->scheme, "nfs") != 0) {
>> + if (!uri->scheme || strcmp(uri->scheme, "nfs") != 0) {
>> error_setg(errp, "URI scheme must be 'nfs'");
>> goto out;
>> }
>
> Consider g_strcmp0().
Nice, thanks!
Max
signature.asc
Description: OpenPGP digital signature