Linux Test Project
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Michael Menasherov <mmenashe@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v3] read_all: Fix buffer too small for long paths
Date: Tue, 15 Sep 2026 16:44:28 +0200	[thread overview]
Message-ID: <aqlZzGOS3yojgci9@yuki.lan> (raw)
In-Reply-To: <CAHGiOXdkKcpTTqaTxH-xVwPP-MTDOkpe837Q-xrgO8Hro5gdTA@mail.gmail.com>

Hi!
> Thanks for explaining the problem with the code. I took a better look at it.
> How about checking before the write instead:
> 
>       while (q->data[i]) {
>           if (j >= BUFFER_SIZE - 1)
>               tst_brk(TBROK, "Buffer is too small for path");
> 
>           q->popped[j++] = q->data[i];
>           i = (i + 1) % QUEUE_SIZE;
>       }
>       q->popped[j] = '\0';
> 
>   j can never reach BUFFER_SIZE without TBROK, and PATH_MAX - 1 paths
>   still fit. Does this look good to you?

Ah, righ, there is tst_brk(), sorry for missing that.

-- 
Cyril Hrubis
chrubis@suse.cz

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

  reply	other threads:[~2026-09-15 14:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08  9:22 [LTP] [PATCH v3] read_all: Fix buffer too small for long paths Michael Menasherov via ltp
2026-09-08 10:42 ` [LTP] " linuxtestproject.agent
2026-09-11  7:17 ` [LTP] [PATCH v3] " Andrea Cervesato via ltp
2026-09-15 12:57 ` Cyril Hrubis
2026-09-15 14:00   ` Michael Menasherov via ltp
2026-09-15 14:44     ` Cyril Hrubis [this message]
2026-09-15 14:52       ` Cyril Hrubis

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=aqlZzGOS3yojgci9@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=mmenashe@redhat.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