Am 14.12.2010 01:40, schrieb Alan Coopersmith:
> Signed-off-by: Alan Coopersmith <[email protected]>
> ---
>  src/Selection.c |    3 ++-
>  src/Shell.c     |    5 +++--
>  2 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/src/Selection.c b/src/Selection.c
> index 1759c02..a138c8b 100644
> --- a/src/Selection.c
> +++ b/src/Selection.c
> @@ -226,7 +226,8 @@ static Atom GetSelectionProperty(
>   propCount = sarray->propCount++;
>   sarray->list = (SelectionProp) XtRealloc((XtPointer)sarray->list,
>               (unsigned)(sarray->propCount*sizeof(SelectionPropRec)));
> - (void) sprintf(propname, "%s%d", "_XT_SELECTION_", propCount);
> + (void) snprintf(propname, sizeof(propname), "%s%d",
> +              "_XT_SELECTION_", propCount);

why not snprintf(propname, sizeof(propname), "_XT_SELECTION_%d",propCount); ?


>   sarray->list[propCount].prop = XInternAtom(dpy, propname, FALSE);
>   sarray->list[propCount].avail = FALSE;
>   return(sarray->list[propCount].prop);
> diff --git a/src/Shell.c b/src/Shell.c
> index 732e978..ef6dad2 100644
> --- a/src/Shell.c
> +++ b/src/Shell.c
> @@ -1780,7 +1780,8 @@ static void GetGeometry(
>       }
>       else hints.flags = 0;
>  
> -     sprintf( def_geom, "%dx%d+%d+%d", width, height, x, y );
> +     snprintf( def_geom, sizeof(def_geom), "%dx%d+%d+%d",
> +               width, height, x, y );
>       flag = XWMGeometry( XtDisplay(W),
>                           XScreenNumberOfScreen(XtScreen(W)),
>                           w->shell.geometry, def_geom,
> @@ -3013,7 +3014,7 @@ static void SetSessionProperties(
>       user_name = _XtGetUserName(nam_buf, sizeof nam_buf);
>       if (user_name)
>           props[num_props++] = ArrayPack(SmUserID, &user_name);
> -     sprintf(pid, "%ld", (long)getpid());
> +     snprintf(pid, sizeof(pid), "%ld", (long)getpid());
>       props[num_props++] = ArrayPack(SmProcessID, &pidp);
>  
>       if (num_props) {
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to