commit:     e46475c945146cd2fe260e6efed68e11df744853
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 16 03:03:40 2017 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Mon Jan 16 03:03:40 2017 +0000
URL:        https://gitweb.gentoo.org/proj/security.git/commit/?id=e46475c9

cvetool: Catch invalid 'info' command usage

 bin/cvetool | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/bin/cvetool b/bin/cvetool
index b8aa5ca..57884ca 100755
--- a/bin/cvetool
+++ b/bin/cvetool
@@ -22,7 +22,16 @@ class CVETool:
         self.auth = auth
 
         if command == 'info':
-            self.info(self.cleanup_cve(sys.argv[2]))
+            if len(args) != 1:
+                print('Usage: info <CVE>')
+                print('Retrieves information about a CVE from database')
+                sys.exit(1)
+
+            try:
+                self.info(self.cleanup_cve(sys.argv[2]))
+            except ValueError:
+                print('"{}" is not a valid CVE 
identifier!'.format(sys.argv[2]))
+                sys.exit(1)
         elif command == 'assign':
             if len(args) < 2:
                 print('Usage: assign <bug> <CVE> [<CVE>...]')

Reply via email to