From: Eric Blake <eblake@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 1/5] util: add base64 decoding function
Date: Wed, 9 Dec 2015 08:18:20 -0700 [thread overview]
Message-ID: <5668463C.8030800@redhat.com> (raw)
In-Reply-To: <20151209125036.GD19914@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1454 bytes --]
On 12/09/2015 05:50 AM, Daniel P. Berrange wrote:
> On Tue, Dec 08, 2015 at 09:18:30AM -0700, Eric Blake wrote:
>> On 11/27/2015 09:30 AM, Daniel P. Berrange wrote:
>>> The standard glib provided g_base64_decode doesn't provide any
>>> kind of sensible error checking on its input. Add a QEMU custom
>>> wrapper qbase64_decode which can be used with untrustworthy
>>> input that can contain invalid base64 characters, embedded
>>> NUL characters, or not be NUL terminated at all.
>>>
>>> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
>>> ---
>>
>>> + uint8_t *actual = qbase64_decode(input,
>>> + input_len,
>>> + &len,
>>> + &err);
>>> +
>>> + g_assert(err != NULL);
>>
>> Could use &error_abort in the original call instead of a second check
>> for err != NULL; but that's cosmetic.
>
> Actually we can't use &error_abort, as we don't want the test
> function to abort on error as that would indicate test failure.
> We want to make sure the call completes & returns an error
> set without aborting.
Whoops; confusing it with g_assert(err == NULL). (Which is why I tend
to just do g_assert(err) or g_assert(!err) instead of having to think
about the comparison with NULL, oh well).
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2015-12-09 15:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-27 16:30 [Qemu-devel] [PATCH v3 0/5] Add framework for passing secrets to QEMU Daniel P. Berrange
2015-11-27 16:30 ` [Qemu-devel] [PATCH v3 1/5] util: add base64 decoding function Daniel P. Berrange
2015-12-08 16:18 ` Eric Blake
2015-12-09 12:50 ` Daniel P. Berrange
2015-12-09 15:18 ` Eric Blake [this message]
2015-11-27 16:30 ` [Qemu-devel] [PATCH v3 2/5] qemu-char: convert to use error checked base64 decode Daniel P. Berrange
2015-11-27 16:30 ` [Qemu-devel] [PATCH v3 3/5] qga: " Daniel P. Berrange
2015-11-27 16:30 ` [Qemu-devel] [PATCH v3 4/5] crypto: add QCryptoSecret object class for password/key handling Daniel P. Berrange
2015-12-08 16:49 ` Eric Blake
2015-12-09 12:56 ` Daniel P. Berrange
2015-11-27 16:30 ` [Qemu-devel] [PATCH v3 5/5] crypto: add support for loading encrypted x509 keys Daniel P. Berrange
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5668463C.8030800@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).