 
	
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] libxl: fix cd insert/eject
 Stefano Stabellini writes ("[Xen-devel] [PATCH] libxl: fix cd insert/eject"):
> +    char backend_type[5];
...
> +    sscanf(backend, "/local/domain/%d/backend/%5[a-z]/%*d/%*d", 
> &disk->backend_domid, backend_type);
>From sscanf(3):
       s      Matches  a  sequence  of  non-white-space  characters;  the next
              pointer must be a pointer to character array that is long enough
              to  hold  the  input sequence and the terminating null character
              ('\0'), which is added automatically.  The input string stops at
              white  space  or  at  the  maximum field width, whichever occurs
              first.
So I think your buffer has an off-by-one error in its size.
Also you should not duplicate a magic number like that.  Use a #define
and preprocessor stringification.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
 
 
 | 
|  | Lists.xenproject.org is hosted with RackSpace, monitoring our |