summaryrefslogtreecommitdiffstats
path: root/daemon/debug.c
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-04-27 15:35:50 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-05-01 14:48:52 +0100
commit8dbc5f201f1da8df8cceed3cae2e735f1e11ae12 (patch)
treeb1a7efd3c935e0e971a274be31f6fd458064d7dd /daemon/debug.c
parent8f9d58a3700a453366d322c49ddb9913f03d3658 (diff)
downloadlibguestfs-8dbc5f201f1da8df8cceed3cae2e735f1e11ae12.tar.gz
libguestfs-8dbc5f201f1da8df8cceed3cae2e735f1e11ae12.tar.xz
libguestfs-8dbc5f201f1da8df8cceed3cae2e735f1e11ae12.zip
debug: 'progress' (unsupported debug command) now checks argument is reasonable (RHBZ#816839).
Thanks Yuyu Zhou. (cherry picked from commit cc798540370658ecc1bba94c4ab4b64485c9bcc6)
Diffstat (limited to 'daemon/debug.c')
-rw-r--r--daemon/debug.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/daemon/debug.c b/daemon/debug.c
index 4036af68..94b84bff 100644
--- a/daemon/debug.c
+++ b/daemon/debug.c
@@ -429,8 +429,12 @@ debug_progress (const char *subcmd, int argc, char *const *const argv)
char *secs_str = argv[0];
unsigned secs;
- if (sscanf (secs_str, "%u", &secs) != 1 || secs == 0)
+ if (sscanf (secs_str, "%u", &secs) != 1)
goto error;
+ if (secs == 0 || secs > 1000000) { /* RHBZ#816839 */
+ reply_with_error ("progress: argument is 0, less than 0, or too large");
+ return NULL;
+ }
unsigned i;
unsigned tsecs = secs * 10; /* 1/10ths of seconds */