Source-Changes-HG archive

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

[src/trunk]: src/sys/netatalk Memset to prevent stack info leak.



details:   https://anonhg.NetBSD.org/src/rev/01ae441e7210
branches:  trunk
changeset: 1004029:01ae441e7210
user:      maxv <maxv%NetBSD.org@localhost>
date:      Wed Oct 09 14:15:40 2019 +0000

description:
Memset to prevent stack info leak.

diffstat:

 sys/netatalk/at_var.h |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r 0d1a94871c7d -r 01ae441e7210 sys/netatalk/at_var.h
--- a/sys/netatalk/at_var.h     Wed Oct 09 14:03:57 2019 +0000
+++ b/sys/netatalk/at_var.h     Wed Oct 09 14:15:40 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: at_var.h,v 1.8 2018/04/19 21:50:10 christos Exp $       */
+/*     $NetBSD: at_var.h,v 1.9 2019/10/09 14:15:40 maxv Exp $   */
 
 /*
  * Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -75,13 +75,13 @@
 {
        sat->sat_port = port;
        sat->sat_addr = *addr;
-       memset(&sat->sat_range, 0, sizeof(sat->sat_range));
 }
 
 static __inline void
 sockaddr_at_init(struct sockaddr_at *sat, const struct at_addr *addr,
     uint8_t port)
 {
+       memset(sat, 0, sizeof(*sat));
        sat->sat_family = AF_APPLETALK;
        sat->sat_len = sizeof(*sat);
        sockaddr_at_init1(sat, addr, port);
@@ -92,7 +92,8 @@
 {
        struct sockaddr *sa;
 
-       sa = sockaddr_alloc(AF_APPLETALK, sizeof(struct sockaddr_at), flags);
+       sa = sockaddr_alloc(AF_APPLETALK, sizeof(struct sockaddr_at),
+           flags | M_ZERO);
 
        if (sa == NULL)
                return NULL;



Home | Main Index | Thread Index | Old Index