[PATCH] cron: Fix parsing of '0' and non-alphanumerics in steps
--Fba/0zbH8Xs+Fj9o
Content-Type: multipart/mixed; boundary="wac7ysb48OaltWcw"
Content-Disposition: inline
--wac7ysb48OaltWcw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
With an entry with "*/0", cron will eat up all CPU, which could be solved w=
ith
attached patch. (essentially same as FreeBSD PR/68683)
Obtained from: OpenBSD
Cheers,
--=20
Xin LI <delphij frontfree net> http://www.delphij.net/
See complete headers for GPG key and other information.
--wac7ysb48OaltWcw
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch-cron-dfly
Content-Transfer-Encoding: quoted-printable
Index: entry.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /home/dcvs/src/usr.sbin/cron/lib/entry.c,v
retrieving revision 1.5
diff -u -r1.5 entry.c
--- entry.c 10 Mar 2004 18:27:28 -0000 1.5
+++ entry.c 5 Jul 2004 09:46:44 -0000
@@ -532,7 +532,7 @@
* sent as a 0 since there is no offset either.
*/
ch =3D get_number(&num3, 0, PPC_NULL, ch, file);
- if (ch =3D=3D EOF)
+ if (ch =3D=3D EOF || num3 =3D=3D 0)
return EOF;
} else {
/* no step. default=3D=3D1.
@@ -582,6 +582,8 @@
ch =3D get_char(file);
}
*pc =3D '\0';
+ if (len =3D=3D 0)
+ return (EOF);
=20
/* try to find the name in the name list
*/
--wac7ysb48OaltWcw--
--Fba/0zbH8Xs+Fj9o
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)
iD8DBQFA6SQaOfuToMruuMARAnA9AJ0QSB7mALPRryBUqeONAvSWgiDxwQCeOoMb
wLQ3HrxZ22VcXKbNz210p1U=
=jWrZ
-----END PGP SIGNATURE-----
--Fba/0zbH8Xs+Fj9o--