Regression introduced by f8585c60831a8e5ddebce18bdd7e78d217a822c5 broke bounds checking for text displayed in input fields.
Since this makes each TEXT_WIDTH value only be used once, just use them directly instead of storing the result in a variable. Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com> --- New in v2 of this series. greeter/Login.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/greeter/Login.c b/greeter/Login.c index 9fd07c4..f448991 100644 --- a/greeter/Login.c +++ b/greeter/Login.c @@ -404,24 +404,21 @@ realizeValue (LoginWidget w, int cursor, int promptNum, GC gc) } else if ((state == LOGIN_PROMPT_ECHO_ON) || (state == LOGIN_TEXT_INFO) || ((state == LOGIN_PROMPT_ECHO_OFF) && (w->login.echo_passwd == True))) { - int textwidth; int offset = max(cursor, VALUE_SHOW_START(w, promptNum)); int textlen = strlen (text + offset); - textwidth = TEXT_WIDTH (text, text + offset, textlen); - - if (textwidth > (width - curoff)) { + if (TEXT_WIDTH (text, text + offset, textlen) > (width - curoff)) { /* Recalculate amount of text that can fit in field */ offset = VALUE_SHOW_START(w, promptNum); textlen = strlen (text + offset); - while ((textlen > 0) && (textwidth > width)) + while ((textlen > 0) && + (TEXT_WIDTH (text, text + offset, textlen) > width)) { if (offset < PROMPT_CURSOR(w, promptNum)) { offset++; } textlen--; - textwidth = TEXT_WIDTH (text, text + offset, textlen); } VALUE_SHOW_START(w, promptNum) = offset; -- 1.7.3.2 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel