[SSSD] [PATCH] Properly detect negative/invalid values for the minId and maxId

Stephen Gallagher sgallagh at redhat.com
Thu Sep 10 20:02:11 UTC 2009


On 09/10/2009 12:00 PM, Simo Sorce wrote:
> On Thu, 2009-09-10 at 11:12 -0400, Stephen Gallagher wrote:
>> Now we'll first read the values in as a string and parse them to
>> ensure
>> that they represent positive numbers.
> 
> Given conversion from string to integer is not a complex business,
> shouldn't we just retrieve the entry as a string and do the conversion
> in a function that returns the enum and saves the integer (if available)
> in a variable ?
> 
> That would save us searching the message twice to get the same string.
> 
> Simo.
> 

New approach attached.

Patch 0001: Create two convenience functions, strtouint32 and
strtoint32. These behave identically to strtol or strtoll, except that
they are guaranteed to be constrained to 32 bits.

Patch 0002: Read the minId and maxId values as a string, testing them
for negation and zero-length before passing them to the function created
in patch 0001 to convert it to a 32-bit value.

-- 
Stephen Gallagher
RHCE 804006346421761

Looking to carve out IT costs?
www.redhat.com/carveoutcosts/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0001-Add-strtoint32-and-strtouint32-convenience-functions.patch
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20090910/51bc4361/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 0002-Properly-detect-negative-invalid-values-for-the-minI.patch
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20090910/51bc4361/attachment-0001.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <https://lists.fedorahosted.org/pipermail/sssd-devel/attachments/20090910/51bc4361/attachment.sig>


More information about the sssd-devel mailing list