From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: [nico@ngolde.de: some code issues] Date: Mon, 07 Jan 2008 06:30:41 -0500 Message-ID: Reply-To: rms@gnu.org NNTP-Posting-Host: lo.gmane.org Content-Type: text/plain; charset=ISO-8859-15 X-Trace: ger.gmane.org 1199705451 5582 80.91.229.12 (7 Jan 2008 11:30:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 7 Jan 2008 11:30:51 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 07 12:31:12 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 1JBqCF-0003hp-Hg for ged-emacs-devel@m.gmane.org; Mon, 07 Jan 2008 12:31:11 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JBqBs-0004cx-G9 for ged-emacs-devel@m.gmane.org; Mon, 07 Jan 2008 06:30:48 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JBqBo-0004bG-Ag for emacs-devel@gnu.org; Mon, 07 Jan 2008 06:30:44 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JBqBm-0004ZR-Ib for emacs-devel@gnu.org; Mon, 07 Jan 2008 06:30:43 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JBqBm-0004ZL-FR for emacs-devel@gnu.org; Mon, 07 Jan 2008 06:30:42 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JBqBm-0002Sf-Fo for emacs-devel@gnu.org; Mon, 07 Jan 2008 06:30:42 -0500 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.60) (envelope-from ) id 1JBqBl-0004Jr-0n; Mon, 07 Jan 2008 06:30:41 -0500 X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) 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:86453 Archived-At: Would someone please fix these in Emacs 22, then ack? ------- Start of forwarded message ------- Date: Sat, 5 Jan 2008 18:59:08 +0100 From: Nico Golde To: bug-gnu-emacs@gnu.org Message-ID: <20080105175908.GA31673@ngolde.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="HlL+5n6rz5pIUxbD" Content-Disposition: inline Subject: some code issues - --HlL+5n6rz5pIUxbD Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, I had a quick look at the pop.c code today and found some=20 issues. In pop_stat: 365 if (strncmp (fromserver, "+OK ", 4)) 366 { 367 if (0 =3D=3D strncmp (fromserver, "-ERR", 4)) 368 { 369 strncpy (pop_error, fromserver, ERROR_MAX); 370 } 371 else 372 { 373 strcpy (pop_error, 374 >=B7=B7=B7 "Unexpected response from POP server in pop_stat"); 375 pop_trash (server); 376 } 377 return (-1); 378 } 380 *count =3D atoi (&fromserver[4]); 381=20 382 fromserver =3D index (&fromserver[4], ' '); 383 if (! fromserver) 384 { 385 strcpy (pop_error, 386 >=B7=B7=B7 "Badly formatted response from server in pop_stat"); 387 pop_trash (server); 388 return (-1); 389 } If I don't miss anything the atoi call in 380 is not save as it is not=20 save because it is not ensure that &fromserver[4] is not NULL. A crafted pop3 server could thus crash emacs. This is of course not a real issue but wouldn't be nice. Same for the pop_last function. In pop_list: 440=20 441 *IDs =3D (int *) malloc ((how_many + 1) * sizeof (int)); 442 *sizes =3D (int *) malloc ((how_many + 1) * sizeof (int)); 443 if (! (*IDs && *sizes)) 444 { 445 strcpy (pop_error, "Out of memory in pop_list"); 446 return (-1); 447 } 448=20 in 441 and 442 there should be some check for how_many to prevent an integer overflow here. Same problem for the xnew macro in etags.c What do you think about this? Kind regards Nico - --=20 Nico Golde - http://www.ngolde.de - nion@jabber.ccc.de - GPG: 0x73647CFF For security reasons, all text in this mail is double-rot13 encrypted. - --HlL+5n6rz5pIUxbD Content-Type: application/pgp-signature Content-Disposition: inline - -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFHf8VsHYflSXNkfP8RAtaHAJ9j0CV6prPJ2LCyKdnDvBSLK37R1QCdHQb0 0AfXr+0Yw3F8LR66YGhKOUw= =tDA3 - -----END PGP SIGNATURE----- - --HlL+5n6rz5pIUxbD-- ------- End of forwarded message -------