Re: [PATCH 14/20] Remove PATH_MAX sized stack allocation from virFileOpenTtyAt

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

 



On Sun, Apr 03, 2011 at 11:21:27AM +0200, Matthias Bolte wrote:
> ---
>  src/util/util.c |    9 ++++-----
>  1 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/src/util/util.c b/src/util/util.c
> index 31feecc..c0391ad 100644
> --- a/src/util/util.c
> +++ b/src/util/util.c
> @@ -1901,14 +1901,13 @@ int virFileOpenTtyAt(const char *ptmx,
>      }
>  
>      if (ttyName) {
> -        char tempTtyName[PATH_MAX];
> -        if (ptsname_r(*ttymaster, tempTtyName, sizeof(tempTtyName)) < 0)
> -            goto cleanup;
> -
> -        if ((*ttyName = strdup(tempTtyName)) == NULL) {
> +        if (VIR_ALLOC_N(*ttyName, PATH_MAX) < 0) {
>              errno = ENOMEM;
>              goto cleanup;
>          }
> +
> +        if (ptsname_r(*ttymaster, *ttyName, PATH_MAX) < 0)
> +            goto cleanup;
>      }

ACK


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]