Re: [PATCH] avoid problems with sign-extended "char" operand to is* functions

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

 



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/
veillard@xxxxxxxxxx  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

--
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]