Source-Changes-HG archive

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

[src/trunk]: src/sbin/cgdconfig Avoid crash when no algorithm is specified in...



details:   https://anonhg.NetBSD.org/src/rev/63abfc1aaab0
branches:  trunk
changeset: 447081:63abfc1aaab0
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Dec 30 12:05:48 2018 +0000

description:
Avoid crash when no algorithm is specified in parameter file.

diffstat:

 sbin/cgdconfig/params.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 05f03cdf549a -r 63abfc1aaab0 sbin/cgdconfig/params.c
--- a/sbin/cgdconfig/params.c   Sun Dec 30 11:55:15 2018 +0000
+++ b/sbin/cgdconfig/params.c   Sun Dec 30 12:05:48 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: params.c,v 1.29 2016/12/11 00:34:39 alnsn Exp $ */
+/* $NetBSD: params.c,v 1.30 2018/12/30 12:05:48 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: params.c,v 1.29 2016/12/11 00:34:39 alnsn Exp $");
+__RCSID("$NetBSD: params.c,v 1.30 2018/12/30 12:05:48 mlelstv Exp $");
 #endif
 
 #include <sys/types.h>
@@ -158,6 +158,8 @@
        if (!p->ivmeth)
                p->ivmeth = string_fromcharstar("encblkno1");
        if (p->keylen == (size_t)-1) {
+               if (p->algorithm == NULL)
+                       return -1;
                i = crypt_defaults_lookup(string_tocharstar(p->algorithm));
                if (i != (size_t)-1) {
                        p->keylen = crypto_defaults[i].keylen;



Home | Main Index | Thread Index | Old Index