qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: Hyman Huang <yong.huang@smartx.com>,
	Fabiano Rosas <farosas@suse.de>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH v2] migration/dirtyrate: Silence warning about strcpy() on OpenBSD
Date: Tue, 22 Oct 2024 11:59:42 -0400	[thread overview]
Message-ID: <ZxfL7lrntriKoVOX@x1n> (raw)
In-Reply-To: <20241022063402.184213-1-thuth@redhat.com>

On Tue, Oct 22, 2024 at 08:34:02AM +0200, Thomas Huth wrote:
> The linker on OpenBSD complains:
> 
>  ld: warning: dirtyrate.c:447 (../src/migration/dirtyrate.c:447)(...):
>  warning: strcpy() is almost always misused, please use strlcpy()
> 
> It's currently not a real problem in this case since both arrays
> have the same size (256 bytes). But just in case somebody changes
> the size of the source array in the future, let's better play safe
> and use g_strlcpy() here instead, with an additional check that the
> string has been copied as a whole.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  v2: Check the return value of g_strlcpy to avoid truncation of the string

queued, thanks.

-- 
Peter Xu



      parent reply	other threads:[~2024-10-22 16:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-22  6:34 [PATCH v2] migration/dirtyrate: Silence warning about strcpy() on OpenBSD Thomas Huth
2024-10-22  6:43 ` Yong Huang
2024-10-22 15:59 ` Peter Xu [this message]

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=ZxfL7lrntriKoVOX@x1n \
    --to=peterx@redhat.com \
    --cc=farosas@suse.de \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=yong.huang@smartx.com \
    /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).