From: Steve Kargl <sgk@troutmask.apl.washington.edu>
To: Jerry D <jvdelisle2@gmail.com>
Cc: Harald Anlauf <anlauf@gmx.de>,
gcc-patches@gcc.gnu.org, fortran@gcc.gnu.org
Subject: Re: [patch, libgfortran] Part 2: PR105456 Child I/O does not propage iostat
Date: Tue, 5 Mar 2024 22:06:42 -0800 [thread overview]
Message-ID: <ZegH8vm-fOB2mitT@troutmask.apl.washington.edu> (raw)
In-Reply-To: <ad440dfe-a441-42ea-8e0a-cc079c67e431@gmail.com>
On Tue, Mar 05, 2024 at 08:06:10PM -0800, Jerry D wrote:
> On 3/5/24 1:51 PM, Harald Anlauf wrote:
> > Hi Jerry,
> >
> > on further thought, do we sanitize 'child_iomsg'?
> > We pass it to snprintf as format.
> >
> > Wouldn't a strncpy be sufficient?
> >
> > Harald
> >
> >
>
> Just to be safe I will bump char message[IOMSG_LEN] to char
> message[IOMSG_LEN + 1]
>
> This is like a C string vs a Fortran string length situation. snprintf
> guarantees we don't exceed the child_iomsg_len and null terminates it.
>
> I added 1 to:
> child_iomsg_len = string_len_trim (IOMSG_LEN, child_iomsg) + 1
>
string_len_trim substracts 1 from the passed in argument.
gfc_charlen_type
string_len_trim (gfc_charlen_type len, const CHARTYPE *s)
{
if (len <= 0)
return 0;
const size_t long_len = sizeof (unsigned long);
size_t i = len - 1;
Does this account for the NULL?
--
steve
next prev parent reply other threads:[~2024-03-06 6:06 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-29 5:29 Jerry D
2024-02-29 9:47 ` Bernhard Reutner-Fischer
2024-02-29 17:36 ` Jerry D
2024-02-29 18:13 ` Steve Kargl
2024-02-29 18:28 ` Jerry D
2024-02-29 20:56 ` Steve Kargl
2024-02-29 22:28 ` Jerry D
2024-03-01 20:50 ` rep.dot.nop
[not found] ` <05A1AEE6-6A68-4D4F-8BEA-6E87969E19E7@gmail.com>
2024-03-05 3:15 ` Jerry D
2024-03-05 21:30 ` rep.dot.nop
2024-03-05 21:37 ` Harald Anlauf
2024-03-05 21:51 ` Harald Anlauf
2024-03-06 4:06 ` Jerry D
2024-03-06 6:06 ` Steve Kargl [this message]
2024-03-06 17:13 ` Harald Anlauf
2024-03-06 17:13 ` Harald Anlauf
2024-03-06 18:03 ` Jerry D
2024-03-06 18:24 ` Jerry D
2024-03-07 4:01 ` Jerry D
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=ZegH8vm-fOB2mitT@troutmask.apl.washington.edu \
--to=sgk@troutmask.apl.washington.edu \
--cc=anlauf@gmx.de \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=jvdelisle2@gmail.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 read-only IMAP folder(s) and NNTP newsgroup(s).