The original code in theory is correct, they could be surrounded by assert().
On Saturday, March 21st, 2026 at 11:20 PM, Theo de Raadt <deraadt@openbsd.org> wrote:
> Why are you not error checking, and accepting truncation?
>
> ZenitDS <zenitds@proton.me> wrote:
>
> > The patch to libphobos/configure got there by mistake.
> > I did not touch it though.
> >
> > On Saturday, March 21st, 2026 at 9:18 PM, ZenitDS <zenitds@proton.me> wrote:
> > > Hi again,
> > >
> > > I have started with the patching and this is what I have got for now.
> > >
> > > Some strcpy's could be changed to their strlcpy variant, but some just
> > > depend on the size of the original string. For those cases I just
> > > substituted by memcpy(). Maybe it is just better to do memcpy() at
> > > every instance since that would preserve completely the semantics of
> > > the strcpy().
> > >
> > > I am having difficulty generating the library again after having built
> > > it for the first time. I can do gmake gnatlib inside build-amd64 but
> > > this is very hacky, plus I then cant figure out how to rebuild the package
> > > in the fake-amd64 directory. Is there any documentation on this matter?
> > >
> > > Index: 15/patches/patch-gcc_ada_adaint_c
> > > ===================================================================
> > > RCS file: /cvs/ports/lang/gcc/15/patches/patch-gcc_ada_adaint_c,v
> > > diff -u -p -r1.1.1.1 patch-gcc_ada_adaint_c
> > > --- 15/patches/patch-gcc_ada_adaint_c 18 Aug 2025 19:49:19 -0000 1.1.1.1
> > > +++ 15/patches/patch-gcc_ada_adaint_c 21 Mar 2026 19:15:52 -0000
> > > @@ -1,16 +1,102 @@
> > > Index: gcc/ada/adaint.c
> > > --- gcc/ada/adaint.c.orig
> > > +++ gcc/ada/adaint.c
> > > -@@ -3714,6 +3714,12 @@ void __gnat_killprocesstree (int pid, int sig_num)
> > > - */
> > > +@@ -576,8 +576,8 @@ __gnat_try_lock (char *dir, char *file)
> > > + GNAT_STRUCT_STAT stat_result;
> > > + int fd;
> > > +
> > > +- sprintf (full_path, "%s%c%s", dir, DIR_SEPARATOR, file);
> > > +- sprintf (temp_file, "%s%cTMP-%ld-%ld",
> > > ++ snprintf (full_path, sizeof(full_path), "%s%c%s", dir, DIR_SEPARATOR, file);
> > > ++ snprintf (temp_file, sizeof(temp_file), "%s%cTMP-%ld-%ld",
> > > + dir, DIR_SEPARATOR, (long)getpid(), (long)getppid ());
> > > +
> > > + /* Create the temporary file and write the process number. */
> > > +@@ -756,8 +756,8 @@ __gnat_os_filename (char *filename ATTRIBUTE_UNUSED,
> > > + strcpy (encoding, "encoding=utf8");
> > > + *e_length = strlen (encoding);
> > > + #else
> > > +- strcpy (os_name, filename);
> > > + *o_length = strlen (filename);
> > > ++ memcpy (os_name, filename, *o_length + 1);
> > > + *e_length = 0;
> > > +
No comments:
Post a Comment