From: Oliver Kurth Date: Tue, 27 Aug 2019 19:55:35 +0000 (-0700) Subject: Add Coverity annotations. X-Git-Tag: stable-11.1.0~268 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4fa430fa5be21413e17a9fe6355c613ecb988e2;p=thirdparty%2Fopen-vm-tools.git Add Coverity annotations. Add source code annotations so that Coverity scans will automatically classify certain issues as "intentional." These annotations serve to memorialize these classifications in open-vm-tools source, both for internal reference as well as for partners like Red Hat who run their own Coverity scans on open-vm-tools. --- diff --git a/open-vm-tools/vgauth/lib/proto.c b/open-vm-tools/vgauth/lib/proto.c index 8d1c1c28a..36bd76f16 100644 --- a/open-vm-tools/vgauth/lib/proto.c +++ b/open-vm-tools/vgauth/lib/proto.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2012-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2012-2017,2019 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 @@ -1400,6 +1400,8 @@ VGAuth_SendConnectRequest(VGAuthContext *ctx) pid = Convert_UnsignedInt32ToText(dwPid); #endif + /* Value of pid is always NULL on non-Windows platforms */ + /* coverity[dead_error_line] */ packet = g_markup_printf_escaped(VGAUTH_CONNECT_REQUEST_FORMAT, ctx->comm.sequenceNumber, pid ? pid : ""); @@ -1806,6 +1808,8 @@ VGAuth_SendCreateTicketRequest(VGAuthContext *ctx, Convert_UnsignedInt32ToText((unsigned int)(size_t)userHandle->token); #endif + /* Value of tokenInText is always NULL on non-Windows platforms */ + /* coverity[dead_error_line] */ packet = g_markup_printf_escaped(VGAUTH_CREATETICKET_REQUEST_FORMAT_START, ctx->comm.sequenceNumber, userHandle->userName, diff --git a/open-vm-tools/vgauth/serviceImpl/proto.c b/open-vm-tools/vgauth/serviceImpl/proto.c index f097fb650..b6e7b3f03 100644 --- a/open-vm-tools/vgauth/serviceImpl/proto.c +++ b/open-vm-tools/vgauth/serviceImpl/proto.c @@ -1572,8 +1572,12 @@ ServiceProtoHandleConnection(ServiceConnection *conn, #endif if (err != VGAUTH_E_OK) { + /* Value of err is always VGAUTH_E_OK on non-Windows platforms */ + /* coverity[dead_error_line] */ packet = Proto_MakeErrorReply(conn, req, err, "connect failed"); } else { + /* Value of event is always NULL on non-Windows platforms */ + /* coverity[dead_error_line] */ packet = g_markup_printf_escaped(VGAUTH_CONNECT_REPLY_FORMAT, req->sequenceNumber, event ? event : ""); @@ -1995,6 +1999,8 @@ ServiceProtoValidateTicket(ServiceConnection *conn, if (err != VGAUTH_E_OK) { packet = Proto_MakeErrorReply(conn, req, err, "validateTicket failed"); } else { + /* Value of token is always NULL on non-Windows platforms */ + /* coverity[dead_error_line] */ packet = g_markup_printf_escaped(VGAUTH_VALIDATETICKET_REPLY_FORMAT_START, req->sequenceNumber, userName, @@ -2165,6 +2171,8 @@ ServiceProtoValidateSamlBearerToken(ServiceConnection *conn, SU_(validate.samlBearer.success, "Validated SAML bearer token for user '%s'"), userName); + /* Value of tokenStr is always NULL on non-Windows platforms */ + /* coverity[dead_error_line] */ packet = g_markup_printf_escaped(VGAUTH_VALIDATESAMLBEARERTOKEN_REPLY_FORMAT_START, req->sequenceNumber, userName ? userName : "",