taescbc: fix segfault on backspace - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit e80159c932a9f8728a7e8adf6a79282dec98a61d
 (DIR) parent aac05c40926da9a9742e4eaaa1b02ea77539e223
 (HTM) Author: David du Colombier <0intro@gmail.com>
       Date:   Wed,  7 Dec 2011 12:27:07 -0500
       
       aescbc: fix segfault on backspace
       
       R=rsc
       CC=plan9port.codebot
       http://codereview.appspot.com/5440107
       
       Diffstat:
         M src/cmd/auth/secstore/aescbc.c      |       7 +++++--
       
       1 file changed, 5 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/src/cmd/auth/secstore/aescbc.c b/src/cmd/auth/secstore/aescbc.c
       t@@ -1,8 +1,9 @@
       -/* encrypt file by writing
       +/*
       +encrypt file by writing
                v2hdr,
                16byte initialization vector,
                AES-CBC(key, random | file),
       -    HMAC_SHA1(md5(key), AES-CBC(random | file))
       +HMAC_SHA1(md5(key), AES-CBC(random | file))
        */
        #include <u.h>
        #include <libc.h>
       t@@ -91,6 +92,8 @@ main(int argc, char **argv)
                                buf[--n] = 0;
                }else{
                        pass = readcons("aescbc password", nil, 1);
       +                if(pass == nil)
       +                        exits("readcons");
                        n = strlen(pass);
                        if(n >= BUF)
                                exits("key too long");