On Thu, Apr 24, 2008 at 10:01:10PM +0200, Jim Meyering wrote:
> I spotted this in existing code while doing a review:
> These uses all cause trouble if the byte in question has a value
> larger than 127 and the "char" type is signed.
> 
>       avoid problems with sign-extended "char" operand to is* functions
>       * src/util.h (to_uchar): Define function.
>       * src/sexpr.c (_string2sexpr): Apply to_uchar to is* operand.
>       * src/nodeinfo.c (linuxNodeInfoCPUPopulate): Likewise.
>       * src/qemu_driver.c (qemudExtractMonitorPath): Likewise.
>       * src/stats_linux.c (xenLinuxDomainDeviceID): Likewise.
>       * src/util.c (TOLOWER, __virMacAddrCompare, virParseMacAddr): Likewise.
>       * src/virsh.c (cmdVcpupin, vshCommandGetToken): Likewise.

  Hum, yes, let's fix this.
But honnestly, we use the is* functions for parsing and checking input,
and one thing I worry about is having a behaviour different based
on the user locale. For example I see we now use isupper/islower/isspace
which are locale dependant, they seems to be confined to places which are
not raw user input, but we should keep an eye to avoid problems.
  
  Patch is fine by me, +1

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

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

Reply via email to