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

Re: [Libvir] PATCH: 7/10: python auth callback API



On Thu, Nov 29, 2007 at 05:20:52PM +0000, Daniel P. Berrange wrote:
> This adds a binding for the virConnectOpenAuth() api in the python
> API. This allows a python function to be used as the callback.
> 

>  src/qemu_conf.c  |    8 +--

Opps, this wasn't mean to sneak in this patch. This fixes a wierd crash
case which happens occassionally when libvirtd starts up. For me it only
ever happens if i run configure with a --prefix pointing to a non-default
value, eg /home/berrange/src/xen/libvirt

Interestingly valgrind fails to catch this off-by-1 flaw

> diff -r 8a79678f789f src/qemu_conf.c
> --- a/src/qemu_conf.c	Wed Nov 28 23:01:30 2007 -0500
> +++ b/src/qemu_conf.c	Wed Nov 28 23:29:40 2007 -0500
> @@ -2667,7 +2667,7 @@ checkLinkPointsTo(const char *checkLink,
>          char *p;
>  
>          strncpy(dir, checkLink, PATH_MAX);
> -        dir[PATH_MAX] = '\0';
> +        dir[PATH_MAX-1] = '\0';
>  
>          if (!(p = strrchr(dir, '/'))) {
>              qemudLog(QEMUD_WARN, "Symlink path '%s' is not absolute", checkLink);
> @@ -2685,7 +2685,7 @@ checkLinkPointsTo(const char *checkLink,
>          }
>  
>          strncpy(dest, tmp, PATH_MAX);
> -        dest[PATH_MAX] = '\0';
> +        dest[PATH_MAX-1] = '\0';
>      }
>  
>      /* canonicalize both paths */
> @@ -2693,14 +2693,14 @@ checkLinkPointsTo(const char *checkLink,
>          qemudLog(QEMUD_WARN, "Failed to expand path '%s' :%s",
>                   dest, strerror(errno));
>          strncpy(real, dest, PATH_MAX);
> -        real[PATH_MAX] = '\0';
> +        real[PATH_MAX-1] = '\0';
>      }
>  
>      if (!realpath(checkDest, checkReal)) {
>          qemudLog(QEMUD_WARN, "Failed to expand path '%s' :%s",
>                   checkDest, strerror(errno));
>          strncpy(checkReal, checkDest, PATH_MAX);
> -        checkReal[PATH_MAX] = '\0';
> +        checkReal[PATH_MAX-1] = '\0';
>      }
>  
>      /* compare */
> 
> -- 
> |=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
> |=-           Perl modules: http://search.cpan.org/~danberr/              -=|
> |=-               Projects: http://freshmeat.net/~danielpb/               -=|
> |=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
> 
> --
> Libvir-list mailing list
> Libvir-list redhat com
> https://www.redhat.com/mailman/listinfo/libvir-list

-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 


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