From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2640 invoked by alias); 30 Nov 2013 03:40:03 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 2616 invoked by uid 89); 30 Nov 2013 03:40:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.1 required=5.0 tests=AWL,BAYES_50,RDNS_NONE,URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: relay1.mentorg.com Received: from Unknown (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 30 Nov 2013 03:40:01 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1VmbPG-0007W1-0f from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Fri, 29 Nov 2013 19:39:46 -0800 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Fri, 29 Nov 2013 19:39:45 -0800 Received: from qiyao.dyndns.org.dyndns.org (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.2.247.3; Fri, 29 Nov 2013 19:39:45 -0800 From: Yao Qi To: Subject: [PATCH] Fix PR remote/15974 Date: Sat, 30 Nov 2013 05:47:00 -0000 Message-ID: <1385782688-375-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2013-11/txt/msg00953.txt.bz2 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 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