[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 10/15: Fix ps -o %r infinite loop
From: |
Samuel Thibault |
Subject: |
[hurd] 10/15: Fix ps -o %r infinite loop |
Date: |
Sun, 05 Jul 2015 00:42:00 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit f5bc22b18e3c3042dbf7e4ecc38e046b13a2a992
Author: Esa Peuha <address@hidden>
Date: Fri Jun 5 20:28:28 2015 +0530
Fix ps -o %r infinite loop
* libps/fmt.c (_fmt_create): When nothing at all was recognized, break out
instead of looping.
---
libps/fmt.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/libps/fmt.c b/libps/fmt.c
index 0465555..580b097 100644
--- a/libps/fmt.c
+++ b/libps/fmt.c
@@ -68,6 +68,8 @@ _fmt_create (char *src, int posix, struct ps_fmt_specs
*fmt_specs,
src = new_fmt->src;
while (*src != '\0')
{
+ char *start = src;
+
if (field - fields == fields_alloced)
/* Time to grow FIELDS to make room for more. */
{
@@ -172,6 +174,19 @@ _fmt_create (char *src, int posix, struct ps_fmt_specs
*fmt_specs,
/* This field spec doesn't have a name, so use its flags fields
to set the global ones, and skip it. */
{
+ /* if we didn't use any chars, don't loop indefinitely */
+ if (src == start)
+ {
+ if (err_string)
+ asprintf (err_string, "%s: Unknown format spec", src);
+
+ FREE (new_fmt->src);
+ FREE (new_fmt);
+ FREE (fields);
+
+ return EINVAL;
+ }
+
global_clr_flags = clr_flags;
global_inv_flags = inv_flags;
continue;
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 02/15: console-client: avoid nested function, (continued)
- [hurd] 02/15: console-client: avoid nested function, Samuel Thibault, 2015/07/04
- [hurd] 09/15: libdiskfs: do not print a message on ENOMEM, Samuel Thibault, 2015/07/04
- [hurd] 15/15: Merge remote-tracking branch 'upstream/master' into upstream, Samuel Thibault, 2015/07/04
- [hurd] 08/15: Check AWK usability when XKB is enabled, Samuel Thibault, 2015/07/04
- [hurd] 07/15: console-client: Fix lower range of binary search, Samuel Thibault, 2015/07/04
- [hurd] 04/15: utils/rpctrace: fix build with -O0, Samuel Thibault, 2015/07/04
- [hurd] 06/15: console-client: assert precondition, Samuel Thibault, 2015/07/04
- [hurd] 05/15: utils/vmstat: fix integer overflow, Samuel Thibault, 2015/07/04
- [hurd] 03/15: console-client: fix binary search, Samuel Thibault, 2015/07/04
- [hurd] 11/15: Cope with scripts which chmod -x directories, Samuel Thibault, 2015/07/04
- [hurd] 10/15: Fix ps -o %r infinite loop,
Samuel Thibault <=
- [hurd] 14/15: Do not keep mutex locked while waiting for authenticate loop, Samuel Thibault, 2015/07/04
- [hurd] 13/15: utils/rpcscan: new utility, Samuel Thibault, 2015/07/04
- [hurd] 12/15: utils: split-off the message id parsing, Samuel Thibault, 2015/07/04