unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [nico@ngolde.de: some code issues]
@ 2008-01-07 11:30 Richard Stallman
  2008-01-10 15:24 ` Chong Yidong
  2008-01-10 15:27 ` Chong Yidong
  0 siblings, 2 replies; 4+ messages in thread
From: Richard Stallman @ 2008-01-07 11:30 UTC (permalink / raw)
  To: emacs-devel

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 <nico@ngolde.de>
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 -------

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [nico@ngolde.de: some code issues]
  2008-01-07 11:30 [nico@ngolde.de: some code issues] Richard Stallman
@ 2008-01-10 15:24 ` Chong Yidong
  2008-01-10 15:27 ` Chong Yidong
  1 sibling, 0 replies; 4+ messages in thread
From: Chong Yidong @ 2008-01-10 15:24 UTC (permalink / raw)
  To: rms, Nico Golde; +Cc: emacs-devel

> In pop_stat:
> If I don't miss anything the atoi call in 380 is not save as it is not
> 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:
> in 441 and 442 there should be some check for how_many to prevent an integer
> overflow here.

Fixed, thanks.

> Same problem for the xnew macro in etags.c

I don't think this is a problem considering how xnew is called. Unless
you can point out a specific problem.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [nico@ngolde.de: some code issues]
  2008-01-07 11:30 [nico@ngolde.de: some code issues] Richard Stallman
  2008-01-10 15:24 ` Chong Yidong
@ 2008-01-10 15:27 ` Chong Yidong
  2008-01-10 15:35   ` Nico Golde
  1 sibling, 1 reply; 4+ messages in thread
From: Chong Yidong @ 2008-01-10 15:27 UTC (permalink / raw)
  To: rms; +Cc: Nico Golde, emacs-devel

> I had a quick look at the pop.c code today and found some
> issues.
>
> In pop_stat:
>
> If I don't miss anything the atoi call in 380 is not save as it is not
> 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:
>
> in 441 and 442 there should be some check for how_many to prevent an integer
> overflow here.

Fixed.  Thanks for pointing these out.

> Same problem for the xnew macro in etags.c

I don't think this is a problem, considering the way the xnew macro is
called in etags.c --- unless you can point to a specific problem.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [nico@ngolde.de: some code issues]
  2008-01-10 15:27 ` Chong Yidong
@ 2008-01-10 15:35   ` Nico Golde
  0 siblings, 0 replies; 4+ messages in thread
From: Nico Golde @ 2008-01-10 15:35 UTC (permalink / raw)
  To: Chong Yidong; +Cc: rms, emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 870 bytes --]

Hi Chong,
* Chong Yidong <cyd@stupidchicken.com> [2008-01-10 16:29]:
> > I had a quick look at the pop.c code today and found some
> > issues.
> >
> > In pop_stat:
> >
> > If I don't miss anything the atoi call in 380 is not save as it is not
> > 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:
> >
> > in 441 and 442 there should be some check for how_many to prevent an integer
> > overflow here.
> 
> Fixed.  Thanks for pointing these out.

What do you think about requesting a CVE id for this?

Kind regards
Nico
-- 
Nico Golde - http://www.ngolde.de - nion@jabber.ccc.de - GPG: 0x73647CFF
For security reasons, all text in this mail is double-rot13 encrypted.

[-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-01-10 15:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-07 11:30 [nico@ngolde.de: some code issues] Richard Stallman
2008-01-10 15:24 ` Chong Yidong
2008-01-10 15:27 ` Chong Yidong
2008-01-10 15:35   ` Nico Golde

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).