This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR remote/15974


In remote-notif.c:handle_notification, we have a loop,

  for (i = 0; i < ARRAY_SIZE (notifs); i++)
    {
      nc = notifs[i];
      if (strncmp (buf, nc->name, strlen (nc->name)) == 0
	  && buf[strlen (nc->name)] == ':')
	break;
    }

  /* We ignore notifications we don't recognize, for compatibility
     with newer stubs.  */
  if (nc == NULL)
    return;

If the notification is not in the list 'notifs', the last entry is
used, which is wrong.  It should be NULL.  This patch sets 'nc' to
NULL in the loop.

gdb:

2013-11-30  Yao Qi  <yao@codesourcery.com>

	PR remote/15974
	* remote-notif.c (handle_notification): Set variable 'nc' to
	NULL in loop.
---
 gdb/remote-notif.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/gdb/remote-notif.c b/gdb/remote-notif.c
index 0d59279..598e888 100644
--- a/gdb/remote-notif.c
+++ b/gdb/remote-notif.c
@@ -136,6 +136,7 @@ handle_notification (struct remote_notif_state *state, char *buf)
       if (strncmp (buf, nc->name, strlen (nc->name)) == 0
 	  && buf[strlen (nc->name)] == ':')
 	break;
+      nc = NULL;
     }
 
   /* We ignore notifications we don't recognize, for compatibility
-- 
1.7.7.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]