From: John Wolfe Date: Thu, 8 Sep 2022 21:51:40 +0000 (-0700) Subject: lib/rpcin/rpcin.c: Address issues reported by Coverity. X-Git-Tag: stable-12.2.0~107 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2875dd33aa494879103b9bf6a635781a99c1292a;p=thirdparty%2Fopen-vm-tools.git lib/rpcin/rpcin.c: Address issues reported by Coverity. --- diff --git a/open-vm-tools/lib/rpcIn/rpcin.c b/open-vm-tools/lib/rpcIn/rpcin.c index 8b1fe759d..8e611ece6 100644 --- a/open-vm-tools/lib/rpcIn/rpcin.c +++ b/open-vm-tools/lib/rpcIn/rpcin.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 1998-2020 VMware, Inc. All rights reserved. + * Copyright (C) 1998-2020, 2022 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -380,7 +380,7 @@ RpcIn_UnregisterCallback(RpcIn *in, // IN * If we called UnregisterCallback on a name that doesn't exist, we * have a problem. */ - ASSERT(cur != NULL); + VERIFY(cur != NULL); if (prev == NULL) { in->callbacks = cur->next; @@ -1357,6 +1357,11 @@ RpcInExecRpc(RpcIn *in, // IN statusStr = status ? "OK " : "ERROR "; statusLen = strlen(statusStr); + /* + * Coverity warns that we don't allocate enough space for a null terminator. + * A null terminator is not necessary here as we also store the length. + */ + // coverity[alloc_strlen] in->last_result = (char *)malloc(statusLen + resultLen); if (in->last_result == NULL) { *errmsg = "RpcIn: Not enough memory";