Source-Changes-HG archive

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

[src/trunk]: src/sys/lib/libsa Check bounds on input. From Michael Plass.



details:   https://anonhg.NetBSD.org/src/rev/3a0afaf3c882
branches:  trunk
changeset: 347617:3a0afaf3c882
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Sep 05 21:11:11 2016 +0000

description:
Check bounds on input. From Michael Plass.

diffstat:

 sys/lib/libsa/checkpasswd.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (22 lines):

diff -r bf115959db7d -r 3a0afaf3c882 sys/lib/libsa/checkpasswd.c
--- a/sys/lib/libsa/checkpasswd.c       Mon Sep 05 20:58:51 2016 +0000
+++ b/sys/lib/libsa/checkpasswd.c       Mon Sep 05 21:11:11 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: checkpasswd.c,v 1.9 2011/01/06 02:45:13 jakllsch Exp $ */
+/*     $NetBSD: checkpasswd.c,v 1.10 2016/09/05 21:11:11 dholland Exp $        */
 
 /*-
  * Copyright (c) 1993
@@ -84,8 +84,10 @@
                        putchar('\n');
                        break;
                default:
-                       *lp++ = c;
-                       putchar('*');
+                       if ((size_t)(lp - buf) < sizeof(buf) - 1) {
+                               *lp++ = c;
+                               putchar('*');
+                       }
                        break;
                }
        }



Home | Main Index | Thread Index | Old Index