Re: [PATCH] dmsetup: fix sscanf return check

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

 



On Thu, Aug 23, 2012 at 02:31:02PM +0100, Matthew Booth wrote:
> -	if (sscanf(ptr, "%llu %llu %s %n",
> -		   &start, &size, ttype, &n) < 3) {
> +	if (sscanf(ptr, "%llu %llu %s %n", &start, &size, ttype, &n) != 4) {

Did you test this?

According to the sscanf man page:

       n      Nothing is expected; instead, the number of characters  consumed
              thus  far  from  the  input  is stored through the next pointer,
              which must be a pointer to  int.   This  is  not  a  conversion,
              although  it can be suppressed with the * assignment-suppression
              character.  The C standard says: "Execution of  a  %n  directive
              does  not increment the assignment count returned at the comple-
              tion of execution" but the Corrigendum seems to contradict this.
              Probably it is wise not to make any assumptions on the effect of
              %n conversions on the return value.

Alasdair

_______________________________________________
linux-lvm mailing list
linux-lvm@redhat.com
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/


[Index of Archives]     [Gluster Users]     [Kernel Development]     [Linux Clusters]     [Device Mapper]     [Security]     [Bugtraq]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]

  Powered by Linux