Mesa (mesa_7_7_branch): progs/xdemos: Check for string overflow.

Vinson Lee vlee at kemper.freedesktop.org
Thu Jan 7 02:09:05 UTC 2010


Module: Mesa
Branch: mesa_7_7_branch
Commit: 25ffd7627828d5a6d1858e0fd5f2a4b796c72be8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=25ffd7627828d5a6d1858e0fd5f2a4b796c72be8

Author: Vinson Lee <vlee at vmware.com>
Date:   Wed Jan  6 18:08:17 2010 -0800

progs/xdemos: Check for string overflow.

---

 progs/xdemos/sharedtex_mt.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/progs/xdemos/sharedtex_mt.c b/progs/xdemos/sharedtex_mt.c
index f924448..a90903a 100644
--- a/progs/xdemos/sharedtex_mt.c
+++ b/progs/xdemos/sharedtex_mt.c
@@ -174,6 +174,10 @@ AddWindow(Display *dpy, const char *displayName, int xpos, int ypos,
    {
       static int id = 0;
       struct window *h = &Windows[NumWindows];
+      if (strlen(displayName) + 1 > sizeof(h->DisplayName)) {
+         Error(displayName, "string overflow");
+         return NULL;
+      }
       strcpy(h->DisplayName, displayName);
       h->Dpy = dpy;
       h->Win = win;




More information about the mesa-commit mailing list