All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Cervesato via ltp <ltp@lists.linux.it>
To: "Petr Vorel" <pvorel@suse.cz>
Cc: Linux Test Project <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH 1/3] lib: Avoid loop_info.lo_name buffer overflow
Date: Tue, 28 Jul 2026 14:19:24 +0000	[thread overview]
Message-ID: <6a68ba6d.6ab3636b.1b6ed.778e@mx.google.com> (raw)
In-Reply-To: <20260728135858.GB1128467@pevik>

Hi Petr,

> I suppose strncpy() is recommended as safer alternative to strcpy(),
> right? Shouldn't we check for strlen(file) is not longer than
> sizeof(loopinfo.lo_name) -1 while we are at it?

we don't need to check for strlen(file) because strncpy() copy
min(strlen(loopinfo.lo_name), strlen(file)) chars at max.

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2026-07-28 14:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17 12:33 [LTP] [PATCH 0/3] Fix bugs in LTP core library Andrea Cervesato
2026-07-17 12:33 ` [LTP] [PATCH 1/3] lib: Avoid loop_info.lo_name buffer overflow Andrea Cervesato
2026-07-17 13:33   ` [LTP] " linuxtestproject.agent
2026-07-28 13:58   ` [LTP] [PATCH 1/3] " Petr Vorel
2026-07-28 14:19     ` Andrea Cervesato via ltp [this message]
2026-07-28 21:02       ` Petr Vorel
2026-07-17 12:33 ` [LTP] [PATCH 2/3] lib: Close directory fd on ENOSPC in tst_fill_fs Andrea Cervesato
2026-07-28 14:00   ` Petr Vorel
2026-07-17 12:33 ` [LTP] [PATCH 3/3] lib: Fix wrong field in tst_iovec_alloc Andrea Cervesato
2026-07-28 14:02   ` Petr Vorel

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=6a68ba6d.6ab3636b.1b6ed.778e@mx.google.com \
    --to=ltp@lists.linux.it \
    --cc=andrea.cervesato@suse.com \
    --cc=pvorel@suse.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.