Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/mail PR/47237: Steffen Nurpmeso: Detect more than 2 ...



details:   https://anonhg.NetBSD.org/src/rev/aa948b808982
branches:  trunk
changeset: 782877:aa948b808982
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Nov 24 21:40:02 2012 +0000

description:
PR/47237: Steffen Nurpmeso: Detect more than 2 pad characters and mark as bad.

diffstat:

 usr.bin/mail/mime_codecs.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (39 lines):

diff -r 468aa6804dc4 -r aa948b808982 usr.bin/mail/mime_codecs.c
--- a/usr.bin/mail/mime_codecs.c        Sat Nov 24 20:56:39 2012 +0000
+++ b/usr.bin/mail/mime_codecs.c        Sat Nov 24 21:40:02 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mime_codecs.c,v 1.9 2009/04/10 13:08:25 christos Exp $ */
+/*     $NetBSD: mime_codecs.c,v 1.10 2012/11/24 21:40:02 christos Exp $        */
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -52,7 +52,7 @@
 
 #include <sys/cdefs.h>
 #ifndef __lint__
-__RCSID("$NetBSD: mime_codecs.c,v 1.9 2009/04/10 13:08:25 christos Exp $");
+__RCSID("$NetBSD: mime_codecs.c,v 1.10 2012/11/24 21:40:02 christos Exp $");
 #endif /* not __lint__ */
 
 #include <assert.h>
@@ -237,6 +237,10 @@
                unsigned c = uchar64(q[2]);
                unsigned d = uchar64(q[3]);
 
+               if (a == BAD || a == EQU || b == BAD || b == EQU ||
+                   c == BAD || d == BAD)
+                       return -1;
+
                *p++ = ((a << 2) | ((b & 0x30) >> 4));
                if (c == EQU)   { /* got '=' */
                        if (d != EQU)
@@ -248,9 +252,6 @@
                        break;
                }
                *p++ = (((c & 0x03) << 6) | d);
-
-               if (a == BAD || b == BAD || c == BAD || d == BAD)
-                       return -1;
        }
 
 #undef uchar64



Home | Main Index | Thread Index | Old Index