[PATCH v2] hurd: readv: Get rid of alloca

Joe Simmons-Talbott josimmon@redhat.com
Mon Jun 19 14:24:11 GMT 2023


On Mon, Jun 19, 2023 at 10:13:25AM -0400, Joe Simmons-Talbott wrote:
> Replace alloca with a scratch_buffer to avoid potential stack overflows.
> 
> Checked on i686-gnu and x86_64-linux-gnu
> ---
> Changes to v1:
>   * Add back the cleanup handler since this is a "shall occur"
>     cancellation point.
> 
>  sysdeps/posix/readv.c | 29 ++++++++++++-----------------
>  1 file changed, 12 insertions(+), 17 deletions(-)
> 
> diff --git a/sysdeps/posix/readv.c b/sysdeps/posix/readv.c
> index 91208e9894..fab35754b0 100644
> --- a/sysdeps/posix/readv.c
> +++ b/sysdeps/posix/readv.c
> @@ -19,16 +19,16 @@
>  #include <unistd.h>
>  #include <string.h>
>  #include <limits.h>
> +#include <scratch_buffer.h>
>  #include <stdbool.h>
>  #include <sys/param.h>
>  #include <sys/uio.h>
>  #include <errno.h>
>  
> -
>  static void
> -ifree (char **ptrp)
> +ifree (struct scratch_buffer *sbuf)
>  {
> -  free (*ptrp);
> +  scratch_buffer_free(sbuf);
>  }

There are a couple of spacing issues here.  I will send a v3 shortly.

Thanks,
Joe



More information about the Libc-alpha mailing list