The branch main has been updated by oshogbo:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=bfb5947bb1e92b08b07a817bd9d8e7f438115e8a

commit bfb5947bb1e92b08b07a817bd9d8e7f438115e8a
Author:     Mariusz Zaborski <osho...@freebsd.org>
AuthorDate: 2021-06-18 16:03:16 +0000
Commit:     Mariusz Zaborski <osho...@freebsd.org>
CommitDate: 2021-06-18 16:05:14 +0000

    sockstat: fix core dump
    
    The get_proto_type function is used before creating the Casper function.
    This is why we have to distinguish when the Casper service is allocated or 
not.
    
    Reported by:    olivier@
    Tested by:      olivier@
---
 usr.bin/sockstat/sockstat.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/usr.bin/sockstat/sockstat.c b/usr.bin/sockstat/sockstat.c
index 7dc5e4904deb..285889a07b7b 100644
--- a/usr.bin/sockstat/sockstat.c
+++ b/usr.bin/sockstat/sockstat.c
@@ -163,7 +163,10 @@ get_proto_type(const char *proto)
 
        if (strlen(proto) == 0)
                return (0);
-       pent = cap_getprotobyname(capnetdb, proto);
+       if (capnetdb != NULL)
+               pent = cap_getprotobyname(capnetdb, proto);
+       else
+               pent = getprotobyname(proto);
        if (pent == NULL) {
                warn("cap_getprotobyname");
                return (-1);
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to