Ed Maste
b5fc583c27
bsdgrep: don't allow negative -A / -B / -C
...
Previously, when given a negative -A/-B/-C argument bsdgrep would
overflow the respective context flag(s) and exhibited surprising
behavior.
Fix this by removing unsignedness of Aflag/Bflag and erroring out if
we're given a value < 0. Also adjust the type used to track 'tail'
context in procfile() so that it accurately reflects the Aflag value
rather than overflowing and losing trailing context.
This also fixes an inconsistency previously existing between -n and
-C "n" behavior. They are now both limited to LLONG_MAX, to be
consistent.
Add some test cases to make sure grep errors out properly for both
negative context values as well as non-numeric context values rather
than giving bogus matches.
Submitted by: Kyle Evans <kevans91@ksu.edu>
Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D10675
2017-05-15 17:51:01 +00:00
..
2016-04-21 12:58:29 +00:00
2015-06-13 19:20:56 +00:00
2017-02-28 23:42:47 +00:00
2016-06-16 21:22:26 +00:00
2015-06-13 19:20:56 +00:00
2016-07-30 06:32:18 +00:00
2017-02-11 20:19:04 +00:00
2017-03-09 03:27:53 +00:00
2017-04-13 23:22:18 +00:00
2017-02-28 23:42:47 +00:00
2017-03-05 16:10:35 +00:00
2017-02-28 23:42:47 +00:00
2017-02-11 20:27:53 +00:00
2017-05-10 22:45:05 +00:00
2015-07-31 16:45:42 +00:00
2017-03-20 13:02:27 +00:00
2017-03-31 03:11:25 +00:00
2017-03-12 18:58:44 +00:00
2017-03-12 18:58:44 +00:00
2015-06-13 19:20:56 +00:00
2015-07-13 14:13:15 +00:00
2015-12-04 03:17:47 +00:00
2017-05-08 14:33:38 +00:00
2017-02-28 23:42:47 +00:00
2016-05-13 05:49:02 +00:00
2017-01-04 16:24:40 +00:00
2017-02-28 23:42:47 +00:00
2017-03-12 18:58:44 +00:00
2017-03-12 18:58:44 +00:00
2017-02-28 23:42:47 +00:00
2017-01-27 20:01:46 +00:00
2017-02-28 23:42:47 +00:00
2017-03-23 03:28:24 +00:00
2017-02-28 23:42:47 +00:00
2016-04-17 23:02:49 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2017-03-12 18:58:44 +00:00
2017-02-28 23:42:47 +00:00
2017-03-20 13:02:27 +00:00
2016-07-29 21:18:20 +00:00
2017-05-08 15:51:29 +00:00
2017-02-28 23:42:47 +00:00
2017-03-12 18:58:44 +00:00
2017-02-28 23:42:47 +00:00
2016-04-21 12:58:29 +00:00
2017-03-05 16:10:35 +00:00
2017-04-24 20:34:56 +00:00
2017-02-28 23:42:47 +00:00
2016-01-27 00:03:43 +00:00
2017-03-12 18:58:44 +00:00
2017-04-17 17:23:19 +00:00
2017-02-28 23:42:47 +00:00
2017-03-12 18:58:44 +00:00
2015-06-13 19:20:56 +00:00
2017-03-12 18:58:44 +00:00
2016-11-13 00:11:30 +00:00
2017-02-06 08:27:19 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2017-03-12 18:58:44 +00:00
2017-02-28 23:42:47 +00:00
2016-03-29 11:56:00 +00:00
2017-03-12 18:58:44 +00:00
2016-05-04 23:20:53 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2017-05-09 01:48:23 +00:00
2017-04-04 19:46:23 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2015-06-13 19:20:56 +00:00
2017-03-12 18:58:44 +00:00
2017-03-30 18:21:36 +00:00
2016-05-10 11:12:31 +00:00
2017-05-09 01:48:14 +00:00
2017-05-14 20:39:01 +00:00
2016-06-04 21:34:06 +00:00
2016-11-13 00:11:30 +00:00
2017-02-28 23:42:47 +00:00
2015-12-04 03:17:47 +00:00
2017-05-15 17:51:01 +00:00
2017-02-06 07:02:17 +00:00
2017-02-28 23:42:47 +00:00
2017-05-09 01:48:23 +00:00
2017-03-12 18:58:44 +00:00
2017-05-09 01:48:23 +00:00
2017-02-28 23:42:47 +00:00
2017-05-09 01:48:23 +00:00
2017-03-03 20:15:22 +00:00
2017-03-12 18:58:44 +00:00
2015-12-01 05:18:48 +00:00
2017-03-12 18:58:44 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2017-04-25 21:59:34 +00:00
2015-06-13 19:20:56 +00:00
2015-06-13 19:20:56 +00:00
2015-06-13 19:20:56 +00:00
2017-02-28 23:42:47 +00:00
2017-05-09 01:48:23 +00:00
2017-05-09 01:48:23 +00:00
2017-05-09 01:48:23 +00:00
2017-02-28 23:42:47 +00:00
2016-05-16 16:01:46 +00:00
2017-02-28 23:42:47 +00:00
2017-05-05 14:33:39 +00:00
2017-03-12 18:58:44 +00:00
2017-03-12 18:58:44 +00:00
2017-03-12 18:58:44 +00:00
2017-04-04 19:46:23 +00:00
2017-03-12 18:58:44 +00:00
2017-05-14 18:47:09 +00:00
2017-03-01 02:10:40 +00:00
2017-02-28 23:42:47 +00:00
2015-06-13 19:20:56 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2015-06-13 19:20:56 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2015-06-13 19:20:56 +00:00
2017-03-12 18:58:44 +00:00
2017-03-12 18:58:44 +00:00
2017-02-28 23:42:47 +00:00
2017-03-12 10:56:19 +00:00
2017-03-12 18:58:44 +00:00
2017-02-28 23:42:47 +00:00
2017-03-12 18:58:44 +00:00
2017-05-09 01:48:23 +00:00
2017-03-12 18:58:44 +00:00
2017-03-12 18:58:44 +00:00
2017-02-28 23:42:47 +00:00
2017-03-12 18:58:44 +00:00
2017-03-12 18:58:44 +00:00
2017-02-28 23:42:47 +00:00
2017-05-10 09:36:34 +00:00
2017-03-12 18:58:44 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2017-05-10 16:06:22 +00:00
2015-10-02 10:08:11 +00:00
2017-02-28 23:42:47 +00:00
2017-05-11 13:46:30 +00:00
2017-03-12 18:58:44 +00:00
2016-11-05 14:08:14 +00:00
2017-04-16 19:17:10 +00:00
2016-05-01 08:22:11 +00:00
2016-08-30 19:02:15 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2016-07-31 19:02:19 +00:00
2016-04-21 12:58:29 +00:00
2017-02-28 23:42:47 +00:00
2016-05-17 12:52:31 +00:00
2015-10-02 10:08:11 +00:00
2017-03-12 18:58:44 +00:00
2017-03-12 18:58:44 +00:00
2017-03-12 18:58:44 +00:00
2017-02-28 23:42:47 +00:00
2017-03-12 18:58:44 +00:00
2017-03-07 05:10:38 +00:00
2017-02-28 23:42:47 +00:00
2017-03-05 16:10:35 +00:00
2016-07-09 04:56:28 +00:00
2017-02-11 23:45:50 +00:00
2017-05-09 01:48:23 +00:00
2017-04-05 16:13:36 +00:00
2016-09-30 13:50:59 +00:00
2017-02-28 23:42:47 +00:00
2017-04-29 21:48:11 +00:00
2017-05-02 21:09:07 +00:00
2017-05-11 07:58:04 +00:00
2015-12-01 05:23:19 +00:00
2017-02-28 23:42:47 +00:00
2016-06-08 02:14:05 +00:00
2016-04-07 04:23:25 +00:00
2017-03-12 18:58:44 +00:00
2017-02-28 23:42:47 +00:00
2017-05-10 14:54:32 +00:00
2017-02-28 23:42:47 +00:00
2017-02-11 23:39:56 +00:00
2017-02-28 23:42:47 +00:00
2017-01-12 14:44:41 +00:00
2017-04-04 19:46:23 +00:00
2017-02-28 23:42:47 +00:00
2017-03-12 18:58:44 +00:00
2017-02-28 23:42:47 +00:00
2017-03-04 04:06:33 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2017-04-08 08:42:25 +00:00
2017-04-24 16:52:26 +00:00
2015-12-01 05:23:19 +00:00
2016-09-16 14:23:16 +00:00
2015-09-25 19:44:01 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2016-04-21 12:58:29 +00:00
2017-03-12 18:58:44 +00:00
2017-03-21 08:57:20 +00:00
2017-03-23 03:28:24 +00:00
2017-02-17 19:53:20 +00:00
2017-02-28 23:42:47 +00:00
2015-06-15 10:56:01 +00:00
2016-04-26 00:29:00 +00:00
2015-06-13 19:20:56 +00:00
2016-04-21 12:58:29 +00:00
2017-02-28 23:42:47 +00:00
2017-03-12 18:58:44 +00:00
2017-04-20 22:30:39 +00:00
2015-06-13 19:20:56 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2017-03-24 00:02:12 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2017-03-12 18:58:44 +00:00
2016-05-04 23:20:53 +00:00
2017-03-12 18:58:44 +00:00
2017-02-28 23:42:47 +00:00
2017-03-09 04:20:00 +00:00
2017-04-22 09:38:43 +00:00
2017-04-17 17:34:47 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2016-05-04 23:20:53 +00:00
2017-05-03 16:03:33 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2016-07-11 08:05:46 +00:00
2017-02-28 23:42:47 +00:00
2017-04-29 06:41:51 +00:00
2015-12-03 14:32:54 +00:00
2017-02-28 23:42:47 +00:00
2017-02-11 23:38:28 +00:00
2017-03-12 18:58:44 +00:00
2017-02-11 23:37:48 +00:00
2015-09-28 07:23:05 +00:00
2015-06-13 19:20:56 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2017-03-10 06:23:15 +00:00
2017-03-12 18:58:44 +00:00
2017-02-28 23:42:47 +00:00
2017-03-12 18:58:44 +00:00
2017-03-12 18:58:44 +00:00
2017-04-21 00:00:23 +00:00
2016-09-14 18:22:12 +00:00
2017-03-12 18:58:44 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2016-05-01 16:13:05 +00:00
2017-04-19 19:55:38 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2017-02-28 23:42:47 +00:00
2017-03-12 18:58:44 +00:00
2016-11-08 23:59:41 +00:00
2016-05-04 23:20:53 +00:00
2017-02-28 23:42:47 +00:00
2017-03-12 18:58:44 +00:00
2017-03-12 18:58:44 +00:00
2017-03-12 18:58:44 +00:00
2017-02-28 23:42:47 +00:00
2015-09-03 07:18:52 +00:00
2015-09-03 07:18:52 +00:00
2017-03-12 18:58:44 +00:00
2017-05-09 01:48:14 +00:00
2017-05-01 19:34:15 +00:00