[gmime] Fixed stack underflow in uudecode example



commit dcf8ad842e909c45a5b96adef219aff4573080d5
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date:   Thu Dec 6 15:48:15 2018 -0500

    Fixed stack underflow in uudecode example
    
    Fixes issue #54

 examples/uudecode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/examples/uudecode.c b/examples/uudecode.c
index d4be10b2..697346ec 100644
--- a/examples/uudecode.c
+++ b/examples/uudecode.c
@@ -195,7 +195,7 @@ uudecode (const char *progname, int argc, char **argv)
                        }
                        
                        n = strlen (inbuf);
-                       midline = inbuf[n - 1] != '\n';
+                       midline = n > 0 && inbuf[n - 1] != '\n';
                        
                        n = decode ((const unsigned char *) inbuf, n, (unsigned char *) outbuf, &state, 
&save);
                        if (fwrite (outbuf, 1, n, fout) != n) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]