Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/net Pull up following revision(s) (requested by mlels...



details:   https://anonhg.NetBSD.org/src/rev/5943857cc3e0
branches:  netbsd-8
changeset: 744826:5943857cc3e0
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Feb 13 19:37:39 2020 +0000

description:
Pull up following revision(s) (requested by mlelstv in ticket #1505):

        sys/net/if_pppoe.c: revision 1.149

safely extract character sequences from packet for printing.

diffstat:

 sys/net/if_pppoe.c |  20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diffs (68 lines):

diff -r 41ec5eba0e6c -r 5943857cc3e0 sys/net/if_pppoe.c
--- a/sys/net/if_pppoe.c        Thu Feb 13 19:34:29 2020 +0000
+++ b/sys/net/if_pppoe.c        Thu Feb 13 19:37:39 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.125.6.9 2018/07/12 15:11:56 martin Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.125.6.10 2020/02/13 19:37:39 martin Exp $ */
 
 /*-
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.125.6.9 2018/07/12 15:11:56 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.125.6.10 2020/02/13 19:37:39 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -524,6 +524,7 @@
        const char *err_msg;
        char devname[IF_NAMESIZE];
        char *error;
+       size_t dlen;
        uint8_t *ac_cookie;
        size_t ac_cookie_len;
        uint8_t *relay_sid;
@@ -610,7 +611,8 @@
                        break;  /* ignored */
                case PPPOE_TAG_ACNAME:
                        if (len > 0) {
-                               error = malloc(len + 1, M_TEMP, M_NOWAIT);
+                               dlen = 4 * len + 1;
+                               error = malloc(dlen, M_TEMP, M_NOWAIT);
                                if (error == NULL)
                                        break;
 
@@ -622,7 +624,9 @@
                                        goto done;
                                }
 
-                               strlcpy(error, mtod(n, char*) + noff, len + 1);
+                               strnvisx(error, dlen,
+                                   mtod(n, char*) + noff, len,
+                                   VIS_SAFE | VIS_OCTAL);
                                printf("pppoe: connected to %s\n", error);
                                free(error, M_TEMP);
                        }
@@ -683,15 +687,17 @@
                if (err_msg) {
                        error = NULL;
                        if (errortag && len) {
-                               error = malloc(len + 1, M_TEMP,
+                               dlen = 4 * len + 1;
+                               error = malloc(dlen, M_TEMP,
                                    M_NOWAIT|M_ZERO);
                                n = m_pulldown(m, off + sizeof(*pt), len,
                                    &noff);
                                if (!n) {
                                        m = NULL;
                                } else if (error) {
-                                       strlcpy(error, mtod(n, char *) + noff,
-                                           len + 1);
+                                       strnvisx(error, dlen,
+                                           mtod(n, char*) + noff, len,
+                                           VIS_SAFE | VIS_OCTAL);
                                }
                        }
                        if (error) {



Home | Main Index | Thread Index | Old Index