After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 787302 - gtk+-3.22.20/gtk/gtkmountoperation-x11.c:669:sanity check after use ?
gtk+-3.22.20/gtk/gtkmountoperation-x11.c:669:sanity check after use ?
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
3.91.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2017-09-05 10:27 UTC by dcb
Modified: 2017-09-12 14:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gtkmountoperation-x11: Do array length check before dereference (1.13 KB, patch)
2017-09-11 08:24 UTC, Philip Withnall
committed Details | Review

Description dcb 2017-09-05 10:27:59 UTC
gtk+-3.22.20/gtk/gtkmountoperation-x11.c:669]: (style) Array index 'n' is used before limits check.

Source code is

          for (; env[n] != '\0' && n < env_len; n++)
            ;

Suggest sanity check array index before use, not after.
Comment 1 Philip Withnall 2017-09-11 08:24:01 UTC
Created attachment 359504 [details] [review]
gtkmountoperation-x11: Do array length check before dereference

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Comment 2 Daniel Boles 2017-09-12 13:53:47 UTC
Review of attachment 359504 [details] [review]:

Ouch!
Comment 3 Philip Withnall 2017-09-12 14:22:41 UTC
Attachment 359504 [details] pushed as 7069dc0 - gtkmountoperation-x11: Do array length check before dereference