From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Use of memcmp in font.c Date: Mon, 09 Jun 2008 17:55:05 -0400 Message-ID: <87ve0iqnnq.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1213048795 13963 80.91.229.12 (9 Jun 2008 21:59:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 9 Jun 2008 21:59:55 +0000 (UTC) Cc: emacs-devel@gnu.org To: Kenichi Handa Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 10 00:00:37 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K5pPi-0007lV-Vq for ged-emacs-devel@m.gmane.org; Tue, 10 Jun 2008 00:00:31 +0200 Original-Received: from localhost ([127.0.0.1]:34265 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K5pOv-0001lA-03 for ged-emacs-devel@m.gmane.org; Mon, 09 Jun 2008 17:59:41 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K5pOp-0001jW-DG for emacs-devel@gnu.org; Mon, 09 Jun 2008 17:59:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K5pOo-0001i6-3J for emacs-devel@gnu.org; Mon, 09 Jun 2008 17:59:35 -0400 Original-Received: from [199.232.76.173] (port=34660 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K5pOo-0001hy-0B for emacs-devel@gnu.org; Mon, 09 Jun 2008 17:59:34 -0400 Original-Received: from cyd.mit.edu ([18.115.2.24]:49269) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K5pOn-0005hP-G3 for emacs-devel@gnu.org; Mon, 09 Jun 2008 17:59:33 -0400 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id 38F104E47D; Mon, 9 Jun 2008 17:55:05 -0400 (EDT) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:98825 Archived-At: Is the use of memcmp in font.c:1384 safe? It seems to me that if the string being parsed ends early, we'll get a segmentation fault. /* Now parse ":KEY=VAL" patterns. Store known keys and values in extra, copy unknown ones to COPY. It is stored in extra slot by the key QCfc_unknown_spec. */ while (*p0) { Lisp_Object key, val; int prop; for (p1 = p0 + 1; *p1 && *p1 != '=' && *p1 != ':'; p1++); if (*p1 != '=') { /* Must be an enumerated value. */ val = font_intern_prop (p0 + 1, p1 - p0 - 1); if (memcmp (p0 + 1, "light", 5) == 0 || memcmp (p0 + 1, "medium", 6) == 0 .....