qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PULL 2/4] coverity: Model GLib string allocation partially
Date: Wed, 11 Feb 2015 19:41:03 +0100	[thread overview]
Message-ID: <54DBA23F.6050409@redhat.com> (raw)
In-Reply-To: <1423153463-26494-3-git-send-email-armbru@redhat.com>



On 05/02/2015 17:24, Markus Armbruster wrote:
> +
> +char *g_strdup(const char *s)
> +{
> +    char *dup;
> +    size_t i;
> +
> +    if (!s) {
> +        return NULL;
> +    }
> +
> +    __coverity_string_null_sink__(s);
> +    __coverity_string_size_sink__(s);

What's __coverity_string_size_sink__?  It is likely responsible for this
in libcacard:

Unbounded source buffer (STRING_SIZE)
string_size: Passing string argv[argc - 2] of unknown size to g_strdup,
which expects a string of a particular size

I guess it's okay to mark this as intentional?

> 
> +char *g_strndup(const char *s, size_t n)
> +{
> +    char *dup;
> +    size_t i;
> +
> +    __coverity_negative_sink__(n);
> +
> +    if (!s) {
> +        return NULL;
> +    }
> +
> +    dup = g_malloc(n + 1);


This should be g_malloc0 I think.

Paolo

  reply	other threads:[~2015-02-11 18:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-05 16:24 [Qemu-devel] [PULL 0/4] coverity: Improve and extend model Markus Armbruster
2015-02-05 16:24 ` [Qemu-devel] [PULL 1/4] coverity: Improve model for GLib memory allocation Markus Armbruster
2015-02-05 16:24 ` [Qemu-devel] [PULL 2/4] coverity: Model GLib string allocation partially Markus Armbruster
2015-02-11 18:41   ` Paolo Bonzini [this message]
2015-02-12  8:52     ` Markus Armbruster
2015-02-05 16:24 ` [Qemu-devel] [PULL 3/4] coverity: Model g_free() isn't necessarily free() Markus Armbruster
2015-02-05 16:24 ` [Qemu-devel] [PULL 4/4] MAINTAINERS: Add myself as Coverity model maintainer Markus Armbruster
2015-02-05 17:11 ` [Qemu-devel] [PULL 0/4] coverity: Improve and extend model Peter Maydell
2015-02-10 16:25   ` Paolo Bonzini
2015-02-11 14:45     ` Markus Armbruster
2015-02-11 18:29       ` Paolo Bonzini
2015-02-12  9:11         ` Markus Armbruster
2015-02-12 14:11           ` Paolo Bonzini

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=54DBA23F.6050409@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=armbru@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).