[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [win-pv-devel] [PATCH 4/4] Make sure input buffers are always null-terminated



On Thu, 7 Nov 2019 at 15:53, Owen Smith <owen.smith@xxxxxxxxxx> wrote:
>
> Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
> ---
>  src/tty/tty.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/src/tty/tty.c b/src/tty/tty.c
> index c3dfcf9..cb1378d 100644
> --- a/src/tty/tty.c
> +++ b/src/tty/tty.c
> @@ -317,6 +317,8 @@ GetCredentials(
>                        sizeof (Context->UserName),
>                        &Size,
>                        FALSE);
> +    Context->UserName[MAXIMUM_BUFFER_SIZE - 1] = TEXT('\0');
> +

I'd prefer use of sizeof() here...

>      if (!Success)
>          return FALSE;
>
> @@ -338,6 +340,8 @@ GetCredentials(
>                        PasswordSize,
>                        &Size,
>                        TRUE);
> +    Password[(PasswordSize / sizeof(TCHAR)) - 1] = TEXT('\0');
> +
>      if (!Success)
>          return FALSE;
>
> @@ -384,6 +388,8 @@ RequestElevation(
>                        sizeof (Buffer),
>                        &Size,
>                        FALSE);
> +    Buffer[MAXIMUM_BUFFER_SIZE - 1] = TEXT('\0');
> +

...and here.

  Paul

>      if (!Success)
>          return FALSE;
>
> --
> 2.16.2.windows.1
>
>
> _______________________________________________
> win-pv-devel mailing list
> win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> https://lists.xenproject.org/mailman/listinfo/win-pv-devel

_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/win-pv-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.