On 07/ 1/13 10:04 AM, Julien Cristau wrote:
Avoid dereferencing argv[argc].

See 
http://www.forallsecure.com/bug-reports/011f1a55f79a5501b36008d6ee0d40e8b6644569/

Reported-by: Alexandre Rebert <[email protected]>
Signed-off-by: Julien Cristau <[email protected]>
---
  main.c |   16 ++++++++++++++++
  1 file changed, 16 insertions(+)

diff --git a/main.c b/main.c
index e42b0cf..6ccb09b 100644
--- a/main.c
+++ b/main.c
@@ -242,6 +242,8 @@ main(int argc, char *argv[])
                        break;
                case 'D':
                        if (argv[0][2] == '\0') {
+                                if (argc < 2)
+                                       fatalerr("Missing argument for -D\n");

Code is fine, but it appears that you've used spaces on the if line &
tabs on the fatalerr() line in each place, making the indentation look
funny in a few spots - would be nice to do a quick global-replace to
clean that up.

Reviewed-by: Alan Coopersmith <[email protected]>

--
        -Alan Coopersmith-              [email protected]
         Oracle Solaris Engineering - http://blogs.oracle.com/alanc


--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: http://lists.debian.org/[email protected]

Reply via email to