archive mirror
 help / color / mirror / Atom feed
From: "VAUTRIN Emmanuel (Canal Plus Prestataire)" <>
To: "Lukáš Karas" <>,
	"" <>
Subject: RE: [PATCH] replace strncopy by memcpy
Date: Fri, 18 Jun 2021 12:38:59 +0000	[thread overview]
Message-ID: <> (raw)

Hello Lukáš

Thank you for your patch, but, even if I have not checked the 
related sources, I really doubt about your fix. Maybe it will not
be a problem, due to the following check:
if ((uptr + ulen) > uncomp_end)
 			goto out;

> memcpy is equivalent to strncpy here as pointed by Santtu.
Please be careful, no more warning does not always imply that
the problem has been fixed. The warning has only disappear here
because you have replaced the call to strncpy by another one.
memcpy and  strncpy are not equivalent.
strncpy is dedicated to string processing, and enables to avoid not
null terminated strings, when the string length is equal to the destination
buffer size.
The good fix is just to replace, in the strncpy call,  ulen by  ulen -1 or
If you really want to propose a patch, please refer to the commits
(sources code + commit message) I mentioned
& 3dbcc963a66d43e4ac51c97de4fe116ec72eb9f6),
it will be a better approach.

Best Regards,


             reply	other threads:[~2021-06-18 12:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-18 12:38 VAUTRIN Emmanuel (Canal Plus Prestataire) [this message]
2021-06-18 17:53 ` [PATCH] replace strncopy by memcpy Santtu Lakkala
2021-06-21  7:00   ` Daniel Wagner
  -- strict thread matches above, loose matches on Subject: below --
2021-06-18  9:27 Lukáš Karas

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* 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).