diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2019-03-09 16:20:48 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2019-03-09 16:47:45 -0800 |
commit | 69e1e1362bbe7883a34227ac4135dd3cd75a348d (patch) | |
tree | a49fc479d393739896ab74cc2293dfe812b170b0 | |
parent | 5d376dd911a50e60631f64637105a2883dd3e7c4 (diff) |
Pass correct number of atoms from SelectSave to _XawTextSaltAwaySelection
When filling in the array, we correctly limited to the 256 slots allocated
but then we reset the value to an unlimited number when passing it on to
the function that walks the array, which could lead to it walking too far.
Fixes https://gitlab.freedesktop.org/xorg/lib/libxaw/issues/2
Reported-by: Praveen Kumar <praveen.pk@samsung.com>
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
(Adapted from libXaw commit c01d47c4c0e0a66e0989d40f73827d0a55f693cc)
-rw-r--r-- | src/TextAction.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/TextAction.c b/src/TextAction.c index f5aaac7..2ec0d97 100644 --- a/src/TextAction.c +++ b/src/TextAction.c @@ -1218,7 +1218,7 @@ ExtendEnd(Widget w, XEvent *event, String *params, Cardinal *num_params) static void SelectSave(Widget w, XEvent *event, String *params, Cardinal *num_params) { - int num_atoms; + int num_atoms, n; Atom* sel; Display* dpy = XtDisplay(w); Atom selections[256]; @@ -1227,9 +1227,8 @@ SelectSave(Widget w, XEvent *event, String *params, Cardinal *num_params) num_atoms = *num_params; if (num_atoms > 256) num_atoms = 256; - for (sel=selections; --num_atoms >= 0; sel++, params++) + for (sel = selections, n = 0; n < num_atoms; n++, sel++, params++) *sel = XInternAtom(dpy, *params, False); - num_atoms = *num_params; _XawTextSaltAwaySelection( (TextWidget) w, selections, num_atoms ); EndAction( (TextWidget) w ); } |