cf3 syntax range checking overflow (AIX)

Matt Richards <[email protected]> Wed, 25 Mar 2009 08:27:12 -0400
Newsgroups gmane.comp.sysutils.cfengine.bugs
Message-ID <[email protected]>
Greetings.

On AIX, there is a overflow in the syntax range checking sccanf. In syntax.c
(CheckParseInt, as well as others functions in syntax.c):

long max = CF_LOWINIT, min = CF_HIGHINIT, val;

...
sscanf(split->name,"%ld",&max);

The conversion overflows a long making it a negative number. Consider the
test program as an example:

  long max;
  long long lmax;

  sscanf ("4026531839", "%lld", &lmax); // max range for mtime
  printf ("%lld\n", lmax);


  sscanf ("4026531839", "%ld", &max); // sscanf in syntax.c
  printf ("%ld\n", max);


Output as follows:
4026531839
-268435457

Thanks,
Matt

_______________________________________________
Bug-cfengine mailing list
[email protected]
https://cfengine.org/mailman/listinfo/bug-cfengine