Merge pull request #12137 from akallabeth/enum-warn-fix

Enum warn fix
This commit is contained in:
akallabeth
2026-01-14 11:33:20 +01:00
committed by GitHub
18 changed files with 155 additions and 80 deletions

View File

@@ -358,14 +358,18 @@ static UINT location_send(LocationClientContext* context, LOCATION_PDUTYPE type,
res = ERROR_INVALID_PARAMETER;
else
{
RDPLOCATION_BASE_LOCATION3D_PDU pdu = { 0 };
LOCATIONSOURCE source = LOCATIONSOURCE_IP;
double speed = FP_NAN;
double heading = FP_NAN;
double horizontalAccuracy = FP_NAN;
pdu.latitude = va_arg(ap, double);
pdu.longitude = va_arg(ap, double);
pdu.altitude = va_arg(ap, INT32);
RDPLOCATION_BASE_LOCATION3D_PDU pdu = { .latitude = va_arg(ap, double),
.longitude = va_arg(ap, double),
.altitude = va_arg(ap, INT32),
.speed = NULL,
.heading = NULL,
.horizontalAccuracy = NULL,
.source = NULL };
if ((count > 3) && (callback->clientVersion >= RDPLOCATION_PROTOCOL_VERSION_200))
{
speed = va_arg(ap, double);
@@ -385,10 +389,10 @@ static UINT location_send(LocationClientContext* context, LOCATION_PDUTYPE type,
res = ERROR_INVALID_PARAMETER;
else
{
RDPLOCATION_LOCATION2D_DELTA_PDU pdu = { 0 };
pdu.latitudeDelta = va_arg(ap, double);
pdu.longitudeDelta = va_arg(ap, double);
RDPLOCATION_LOCATION2D_DELTA_PDU pdu = { .latitudeDelta = va_arg(ap, double),
.longitudeDelta = va_arg(ap, double),
.speedDelta = NULL,
.headingDelta = NULL };
double speedDelta = FP_NAN;
double headingDelta = FP_NAN;
@@ -407,13 +411,14 @@ static UINT location_send(LocationClientContext* context, LOCATION_PDUTYPE type,
res = ERROR_INVALID_PARAMETER;
else
{
RDPLOCATION_LOCATION3D_DELTA_PDU pdu = { 0 };
double speedDelta = FP_NAN;
double headingDelta = FP_NAN;
pdu.latitudeDelta = va_arg(ap, double);
pdu.longitudeDelta = va_arg(ap, double);
pdu.altitudeDelta = va_arg(ap, INT32);
RDPLOCATION_LOCATION3D_DELTA_PDU pdu = { .latitudeDelta = va_arg(ap, double),
.longitudeDelta = va_arg(ap, double),
.altitudeDelta = va_arg(ap, INT32),
pdu.speedDelta = NULL,
.headingDelta = NULL };
if ((count > 3) && (callback->clientVersion >= RDPLOCATION_PROTOCOL_VERSION_200))
{
speedDelta = va_arg(ap, double);

View File

@@ -17,6 +17,8 @@
* limitations under the License.
*/
#include <math.h>
#include <freerdp/config.h>
#include <freerdp/freerdp.h>
@@ -125,14 +127,15 @@ static UINT location_server_open_channel(location_server* location)
static UINT location_server_recv_client_ready(LocationServerContext* context, wStream* s,
const RDPLOCATION_HEADER* header)
{
RDPLOCATION_CLIENT_READY_PDU pdu = { 0 };
UINT error = CHANNEL_RC_OK;
WINPR_ASSERT(context);
WINPR_ASSERT(s);
WINPR_ASSERT(header);
pdu.header = *header;
RDPLOCATION_CLIENT_READY_PDU pdu = { .header = *header,
.protocolVersion = RDPLOCATION_PROTOCOL_VERSION_100,
.flags = 0 };
if (!Stream_CheckAndLogRequiredLength(TAG, s, 4))
return ERROR_NO_DATA;
@@ -170,7 +173,6 @@ static UINT location_server_recv_client_ready(LocationServerContext* context, wS
static UINT location_server_recv_base_location3d(LocationServerContext* context, wStream* s,
const RDPLOCATION_HEADER* header)
{
RDPLOCATION_BASE_LOCATION3D_PDU pdu = { 0 };
UINT error = CHANNEL_RC_OK;
double speed = 0.0;
double heading = 0.0;
@@ -181,7 +183,14 @@ static UINT location_server_recv_base_location3d(LocationServerContext* context,
WINPR_ASSERT(s);
WINPR_ASSERT(header);
pdu.header = *header;
RDPLOCATION_BASE_LOCATION3D_PDU pdu = { .header = *header,
.latitude = FP_NAN,
.longitude = FP_NAN,
.altitude = 0,
.speed = NULL,
.heading = NULL,
.horizontalAccuracy = NULL,
.source = NULL };
if (!freerdp_read_four_byte_float(s, &pdu.latitude) ||
!freerdp_read_four_byte_float(s, &pdu.longitude) ||
@@ -228,7 +237,6 @@ static UINT location_server_recv_base_location3d(LocationServerContext* context,
static UINT location_server_recv_location2d_delta(LocationServerContext* context, wStream* s,
const RDPLOCATION_HEADER* header)
{
RDPLOCATION_LOCATION2D_DELTA_PDU pdu = { 0 };
UINT error = CHANNEL_RC_OK;
double speedDelta = 0.0;
double headingDelta = 0.0;
@@ -237,7 +245,11 @@ static UINT location_server_recv_location2d_delta(LocationServerContext* context
WINPR_ASSERT(s);
WINPR_ASSERT(header);
pdu.header = *header;
RDPLOCATION_LOCATION2D_DELTA_PDU pdu = { .header = *header,
.latitudeDelta = FP_NAN,
.longitudeDelta = FP_NAN,
.speedDelta = NULL,
.headingDelta = NULL };
if (!freerdp_read_four_byte_float(s, &pdu.latitudeDelta) ||
!freerdp_read_four_byte_float(s, &pdu.longitudeDelta))
@@ -263,7 +275,6 @@ static UINT location_server_recv_location2d_delta(LocationServerContext* context
static UINT location_server_recv_location3d_delta(LocationServerContext* context, wStream* s,
const RDPLOCATION_HEADER* header)
{
RDPLOCATION_LOCATION3D_DELTA_PDU pdu = { 0 };
UINT error = CHANNEL_RC_OK;
double speedDelta = 0.0;
double headingDelta = 0.0;
@@ -272,7 +283,11 @@ static UINT location_server_recv_location3d_delta(LocationServerContext* context
WINPR_ASSERT(s);
WINPR_ASSERT(header);
pdu.header = *header;
RDPLOCATION_LOCATION3D_DELTA_PDU pdu = { .header = *header,
.latitudeDelta = FP_NAN,
.longitudeDelta = FP_NAN,
.speedDelta = NULL,
.headingDelta = NULL };
if (!freerdp_read_four_byte_float(s, &pdu.latitudeDelta) ||
!freerdp_read_four_byte_float(s, &pdu.longitudeDelta) ||
@@ -298,20 +313,17 @@ static UINT location_server_recv_location3d_delta(LocationServerContext* context
static UINT location_process_message(location_server* location)
{
BOOL rc = 0;
UINT error = ERROR_INTERNAL_ERROR;
ULONG BytesReturned = 0;
RDPLOCATION_HEADER header = { 0 };
wStream* s = NULL;
WINPR_ASSERT(location);
WINPR_ASSERT(location->location_channel);
s = location->buffer;
wStream* s = location->buffer;
WINPR_ASSERT(s);
Stream_SetPosition(s, 0);
rc = WTSVirtualChannelRead(location->location_channel, 0, NULL, 0, &BytesReturned);
const BOOL rc = WTSVirtualChannelRead(location->location_channel, 0, NULL, 0, &BytesReturned);
if (!rc)
goto out;
@@ -341,8 +353,8 @@ static UINT location_process_message(location_server* location)
{
const UINT16 pduType = Stream_Get_UINT16(s);
header.pduType = (LOCATION_PDUTYPE)pduType;
header.pduLength = Stream_Get_UINT32(s);
const RDPLOCATION_HEADER header = { .pduType = (LOCATION_PDUTYPE)pduType,
.pduLength = Stream_Get_UINT32(s) };
switch (pduType)
{

View File

@@ -190,20 +190,21 @@ static UINT mouse_cursor_server_recv_cs_caps_advertise(MouseCursorServerContext*
wStream* s,
const RDP_MOUSE_CURSOR_HEADER* header)
{
RDP_MOUSE_CURSOR_CAPS_ADVERTISE_PDU pdu = { 0 };
UINT error = CHANNEL_RC_OK;
WINPR_ASSERT(context);
WINPR_ASSERT(s);
WINPR_ASSERT(header);
pdu.header = *header;
/* There must be at least one capability set present */
if (!Stream_CheckAndLogRequiredLength(TAG, s, 12))
return ERROR_NO_DATA;
pdu.capsSets = ArrayList_New(FALSE);
RDP_MOUSE_CURSOR_CAPS_ADVERTISE_PDU pdu = {
.header = *header,
.capsSets = ArrayList_New(FALSE),
};
if (!pdu.capsSets)
{
WLog_ERR(TAG, "Failed to allocate arraylist");
@@ -237,7 +238,6 @@ static UINT mouse_cursor_process_message(mouse_cursor_server* mouse_cursor)
BOOL rc = 0;
UINT error = ERROR_INTERNAL_ERROR;
ULONG BytesReturned = 0;
RDP_MOUSE_CURSOR_HEADER header = { 0 };
wStream* s = NULL;
WINPR_ASSERT(mouse_cursor);
@@ -293,9 +293,10 @@ static UINT mouse_cursor_process_message(mouse_cursor_server* mouse_cursor)
updateType);
return ERROR_INVALID_DATA;
}
header.updateType = (TS_UPDATETYPE_MOUSEPTR)updateType;
Stream_Read_UINT16(s, header.reserved);
RDP_MOUSE_CURSOR_HEADER header = { .updateType = (TS_UPDATETYPE_MOUSEPTR)updateType,
.reserved = Stream_Get_UINT16(s),
.pduType = PDUTYPE_EMSC_RESERVED };
switch (pduType)
{

View File

@@ -690,13 +690,16 @@ static void create_irp_thread(SERIAL_DEVICE* serial, IRP* irp)
* for threads.
*/
}
const BOOL added = ListDictionary_Add(serial->IrpThreads, (void*)key, irpThread);
ListDictionary_Unlock(serial->IrpThreads);
if (!added)
{
WLog_Print(serial->log, WLOG_ERROR, "ListDictionary_Add failed!");
goto error_handle;
const BOOL added = ListDictionary_Add(serial->IrpThreads, (void*)key, irpThread);
ListDictionary_Unlock(serial->IrpThreads);
if (!added)
{
WLog_Print(serial->log, WLOG_ERROR, "ListDictionary_Add failed!");
goto error_handle;
}
}
ResumeThread(irpThread);

View File

@@ -542,14 +542,16 @@ static BOOL ffmpeg_fill_frame(AVFrame* WINPR_RESTRICT frame,
frame->sample_rate = (int)inputFormat->nSamplesPerSec;
frame->format = ffmpeg_sample_format(inputFormat);
const int bpp = av_get_bytes_per_sample(frame->format);
const int bpp =
av_get_bytes_per_sample(WINPR_ASSERTING_INT_CAST(enum AVSampleFormat, frame->format));
WINPR_ASSERT(bpp >= 0);
WINPR_ASSERT(size <= INT_MAX);
const size_t nb_samples = size / inputFormat->nChannels / (size_t)bpp;
frame->nb_samples = (int)nb_samples;
if ((ret = avcodec_fill_audio_frame(frame, inputFormat->nChannels, frame->format, data,
(int)size, 1)) < 0)
if ((ret = avcodec_fill_audio_frame(
frame, inputFormat->nChannels,
WINPR_ASSERTING_INT_CAST(enum AVSampleFormat, frame->format), data, (int)size, 1)) < 0)
{
const char* err = av_err2str(ret);
WLog_ERR(TAG, "Error during audio frame fill %s [%d]", err, ret);

View File

@@ -32,7 +32,7 @@ typedef struct
BYTE* pYUVDstData[3];
UINT32 iDstStride[3];
RECTANGLE_16 rect;
BYTE type;
avc444_frame_type type;
} YUV_COMBINE_WORK_PARAM;
typedef struct
@@ -522,7 +522,7 @@ pool_decode_rect_param(const RECTANGLE_16* WINPR_RESTRICT rect, YUV_CONTEXT* WIN
current.iDstStride[0] = iDstStride[0];
current.iDstStride[1] = iDstStride[1];
current.iDstStride[2] = iDstStride[2];
current.type = type;
current.type = WINPR_ASSERTING_INT_CAST(avc444_frame_type, type);
current.rect = *rect;
return current;
}

View File

@@ -710,7 +710,9 @@ static BOOL autodetect_recv_netchar_sync(rdpAutoDetect* autodetect, RDP_TRANSPOR
static BOOL autodetect_recv_netchar_request(rdpAutoDetect* autodetect, RDP_TRANSPORT_TYPE transport,
wStream* s, const AUTODETECT_REQ_PDU* autodetectReqPdu)
{
rdpNetworkCharacteristicsResult result = { 0 };
rdpNetworkCharacteristicsResult result = {
.type = RDP_NETCHAR_RESERVED, .baseRTT = 0, .averageRTT = 0, .bandwidth = 0
};
BOOL success = TRUE;
WINPR_ASSERT(autodetect);

View File

@@ -206,7 +206,8 @@ typedef enum
{
acceptance,
user_rejection,
provider_rejection
provider_rejection,
negotiate_ack
} p_cont_def_result_t;
typedef enum
@@ -253,14 +254,19 @@ typedef struct
char* port_spec; /* port string spec; size_is(length) */
} port_any_t;
#define REASON_NOT_SPECIFIED 0
#define TEMPORARY_CONGESTION 1
#define LOCAL_LIMIT_EXCEEDED 2
#define CALLED_PADDR_UNKNOWN 3
#define PROTOCOL_VERSION_NOT_SUPPORTED 4
#define DEFAULT_CONTEXT_NOT_SUPPORTED 5
#define USER_DATA_NOT_READABLE 6
#define NO_PSAP_AVAILABLE 7
typedef enum
{
REASON_NOT_SPECIFIED = 0,
TEMPORARY_CONGESTION = 1,
LOCAL_LIMIT_EXCEEDED = 2,
CALLED_PADDR_UNKNOWN = 3,
PROTOCOL_VERSION_NOT_SUPPORTED = 4,
DEFAULT_CONTEXT_NOT_SUPPORTED = 5,
USER_DATA_NOT_READABLE = 6,
NO_PSAP_AVAILABLE = 7,
authentication_type_not_recognized = 8,
invalid_checksum = 9
} bind_rejection_t;
typedef UINT16 rpcrt_reason_code_t;

View File

@@ -739,6 +739,7 @@ static BOOL rts_read_result(wStream* s, p_result_t* result, BOOL silent)
case acceptance:
case user_rejection:
case provider_rejection:
case negotiate_ack:
break;
default:
WLog_ERR(TAG, "Invalid p_cont_def_result_t %" PRIu16, res);

View File

@@ -773,6 +773,13 @@ static BOOL tsg_ndr_read_packet_response(wLog* log, wStream* s, UINT32* index,
return FALSE;
}
if (MaxOffsetValue != 0)
{
WLog_Print(log, WLOG_ERROR, "Unexpected offset value: %" PRIu32 ", expected: 0",
MaxOffsetValue);
return FALSE;
}
if (!Stream_CheckAndLogRequiredLengthWLog(log, s, MaxSizeValue))
return FALSE;

View File

@@ -184,7 +184,9 @@ state_run_t multitransport_recv_response(rdpMultitransport* multi, wStream* s)
Stream_Read_UINT32(s, requestId); /* requestId (4 bytes) */
Stream_Read_UINT32(s, hr); /* hrResponse (4 bytes) */
return IFCALLRESULT(STATE_RUN_SUCCESS, multi->MtResponse, multi, requestId, hr);
state_run_t res = STATE_RUN_SUCCESS;
IFCALLRET(multi->MtResponse, res, multi, requestId, hr);
return res;
}
static state_run_t multitransport_no_udp(rdpMultitransport* multi, UINT32 reqId,

View File

@@ -1356,8 +1356,8 @@ typedef enum
static BOOL nla_read_ts_credentials(rdpNla* nla, SecBuffer* data)
{
WinPrAsn1Decoder dec = { 0 };
WinPrAsn1Decoder dec2 = { 0 };
WinPrAsn1Decoder dec = { .encoding = WINPR_ASN1_BER, { 0 } };
WinPrAsn1Decoder dec2 = { .encoding = WINPR_ASN1_BER, { 0 } };
WinPrAsn1_OctetString credentials = { 0 };
BOOL error = FALSE;
WinPrAsn1_INTEGER credType = -1;
@@ -1424,7 +1424,7 @@ static BOOL nla_read_ts_credentials(rdpNla* nla, SecBuffer* data)
settings->PasswordIsSmartcardPin = TRUE;
/* cspData [1] TSCspDataDetail */
WinPrAsn1Decoder cspDetails = { 0 };
WinPrAsn1Decoder cspDetails = { .encoding = WINPR_ASN1_BER, { 0 } };
if (!WinPrAsn1DecReadContextualSequence(&dec, 1, &error, &cspDetails) && error)
return FALSE;
if (!nla_read_TSCspDataDetail(&cspDetails, settings))
@@ -1444,8 +1444,15 @@ static BOOL nla_read_ts_credentials(rdpNla* nla, SecBuffer* data)
return FALSE;
/* logonCred[0] TSRemoteGuardPackageCred */
KERB_TICKET_LOGON kerbLogon = { 0 };
WinPrAsn1Decoder logonCredsSeq = { 0 };
KERB_TICKET_LOGON kerbLogon = { .MessageType = KerbInvalidValue,
.Flags = 0,
.ServiceTicketLength = 0,
.TicketGrantingTicketLength = 0,
.ServiceTicket = NULL,
.TicketGrantingTicket = NULL };
WinPrAsn1Decoder logonCredsSeq = { .encoding = WINPR_ASN1_BER, { 0 } };
if (!WinPrAsn1DecReadContextualSequence(&dec2, 0, &error, &logonCredsSeq) || error)
return FALSE;
@@ -1468,16 +1475,16 @@ static BOOL nla_read_ts_credentials(rdpNla* nla, SecBuffer* data)
/* supplementalCreds [1] SEQUENCE OF TSRemoteGuardPackageCred OPTIONAL, */
MSV1_0_REMOTE_SUPPLEMENTAL_CREDENTIAL* suppCreds = NULL;
WinPrAsn1Decoder suppCredsSeq = { 0 };
WinPrAsn1Decoder suppCredsSeq = { .encoding = WINPR_ASN1_BER, { 0 } };
if (WinPrAsn1DecReadContextualSequence(&dec2, 1, &error, &suppCredsSeq) &&
Stream_GetRemainingLength(&suppCredsSeq.source))
{
WinPrAsn1Decoder ntlmCredsSeq = { 0 };
WinPrAsn1Decoder ntlmCredsSeq = { .encoding = WINPR_ASN1_BER, { 0 } };
if (!WinPrAsn1DecReadSequence(&suppCredsSeq, &ntlmCredsSeq))
return FALSE;
RemoteGuardPackageCredType suppCredsType = { 0 };
RemoteGuardPackageCredType suppCredsType = RCG_TYPE_NONE;
wStream ntlmPayload = { 0 };
if (!nla_read_TSRemoteGuardPackageCred(nla, &ntlmCredsSeq, &suppCredsType,
&ntlmPayload))
@@ -2059,8 +2066,8 @@ fail:
static int nla_decode_ts_request(rdpNla* nla, wStream* s)
{
WinPrAsn1Decoder dec = { 0 };
WinPrAsn1Decoder dec2 = { 0 };
WinPrAsn1Decoder dec = { .encoding = WINPR_ASN1_BER, { 0 } };
WinPrAsn1Decoder dec2 = { .encoding = WINPR_ASN1_BER, { 0 } };
BOOL error = FALSE;
WinPrAsn1_tagId tag = { 0 };
WinPrAsn1_INTEGER val = { 0 };
@@ -2102,7 +2109,7 @@ static int nla_decode_ts_request(rdpNla* nla, wStream* s)
while (WinPrAsn1DecReadContextualTag(&dec, &tag, &dec2) != 0)
{
WinPrAsn1Decoder dec3 = { 0 };
WinPrAsn1Decoder dec3 = { .encoding = WINPR_ASN1_BER, { 0 } };
WinPrAsn1_OctetString octet_string = { 0 };
switch (tag)

View File

@@ -206,7 +206,7 @@ static BOOL primitives_autodetect_best(primitives_t* prims)
{
const char* name;
primitives_t* prims;
UINT32 flags;
primitive_hints flags;
UINT32 count;
};

View File

@@ -65,9 +65,25 @@ typedef struct
BYTE val4;
} FOUR_BYTE_FLOAT;
static inline FOUR_BYTE_SIGNED_INTEGER FOUR_BYTE_SIGNED_INTEGER_init(void)
{
const FOUR_BYTE_SIGNED_INTEGER empty = {
.c = ONE_BYTE_VAL, .s = POSITIVE_VAL, .val1 = 0, .val2 = 0, .val3 = 0, .val4 = 0
};
return empty;
}
static inline FOUR_BYTE_FLOAT FOUR_BYTE_FLOAT_init(void)
{
const FOUR_BYTE_FLOAT empty = {
.c = ONE_BYTE_VAL, .s = POSITIVE_VAL, .e = 0, .val1 = 0, .val2 = 0, .val3 = 0, .val4 = 0
};
return empty;
}
BOOL freerdp_read_four_byte_signed_integer(wStream* s, INT32* value)
{
FOUR_BYTE_SIGNED_INTEGER si = { 0 };
FOUR_BYTE_SIGNED_INTEGER si = FOUR_BYTE_SIGNED_INTEGER_init();
BYTE byte = 0;
WINPR_ASSERT(s);
@@ -125,7 +141,7 @@ BOOL freerdp_read_four_byte_signed_integer(wStream* s, INT32* value)
BOOL freerdp_write_four_byte_signed_integer(wStream* s, INT32 value)
{
FOUR_BYTE_SIGNED_INTEGER si = { 0 };
FOUR_BYTE_SIGNED_INTEGER si = FOUR_BYTE_SIGNED_INTEGER_init();
WINPR_ASSERT(s);
if (value > FREERDP_FOUR_BYTE_SIGNED_INT_MAX)
@@ -212,7 +228,7 @@ BOOL freerdp_read_four_byte_float(wStream* s, double* value)
BOOL freerdp_read_four_byte_float_exp(wStream* s, double* value, BYTE* exp)
{
FOUR_BYTE_FLOAT f = { 0 };
FOUR_BYTE_FLOAT f = FOUR_BYTE_FLOAT_init();
UINT32 base = 0;
BYTE byte = 0;
@@ -278,7 +294,7 @@ BOOL freerdp_read_four_byte_float_exp(wStream* s, double* value, BYTE* exp)
BOOL freerdp_write_four_byte_float(wStream* s, double value)
{
FOUR_BYTE_FLOAT si = { 0 };
FOUR_BYTE_FLOAT si = FOUR_BYTE_FLOAT_init();
WINPR_ASSERT(s);

View File

@@ -879,8 +879,8 @@ static SECURITY_STATUS get_piv_container_name(NCryptP11KeyHandle* key, const BYT
char container_name[PIV_CONTAINER_NAME_LEN + 1] = { 0 };
DWORD buf_len = 0;
SECURITY_STATUS ret = NTE_BAD_KEY;
WinPrAsn1Decoder dec = { 0 };
WinPrAsn1Decoder dec2 = { 0 };
WinPrAsn1Decoder dec = { .encoding = WINPR_ASN1_BER, { 0 } };
WinPrAsn1Decoder dec2 = { .encoding = WINPR_ASN1_BER, { 0 } };
size_t len = 0;
BYTE tag = 0;
BYTE* p = NULL;

View File

@@ -711,7 +711,7 @@ static BOOL append(char* dst, size_t dstSize, const char* src)
static BOOL kerberos_rd_tgt_req_tag2(WinPrAsn1Decoder* dec, char* buf, size_t len)
{
BOOL rc = FALSE;
WinPrAsn1Decoder seq = { 0 };
WinPrAsn1Decoder seq = { .encoding = WINPR_ASN1_BER, { 0 } };
/* server-name [2] PrincipalName (SEQUENCE) */
if (!WinPrAsn1DecReadSequence(dec, &seq))
@@ -796,7 +796,7 @@ static BOOL kerberos_rd_tgt_req(WinPrAsn1Decoder* dec, char** target)
if (len == 0)
return TRUE;
WinPrAsn1Decoder dec2 = { 0 };
WinPrAsn1Decoder dec2 = { .encoding = WINPR_ASN1_BER, { 0 } };
WinPrAsn1_tagId tag = 0;
if (WinPrAsn1DecReadContextualTag(dec, &tag, &dec2) == 0)
return FALSE;
@@ -842,7 +842,7 @@ static BOOL kerberos_rd_tgt_rep(WinPrAsn1Decoder* dec, krb5_data* ticket)
return FALSE;
/* ticket [2] Ticket */
WinPrAsn1Decoder asnTicket = { 0 };
WinPrAsn1Decoder asnTicket = { .encoding = WINPR_ASN1_BER, { 0 } };
WinPrAsn1_tagId tag = 0;
if (WinPrAsn1DecReadContextualTag(dec, &tag, &asnTicket) == 0)
return FALSE;
@@ -870,11 +870,11 @@ static BOOL kerberos_rd_tgt_token(const sspi_gss_data* token, char** target, krb
if (target)
*target = NULL;
WinPrAsn1Decoder der = { 0 };
WinPrAsn1Decoder der = { .encoding = WINPR_ASN1_BER, { 0 } };
WinPrAsn1Decoder_InitMem(&der, WINPR_ASN1_DER, (BYTE*)token->data, token->length);
/* KERB-TGT-REQUEST (SEQUENCE) */
WinPrAsn1Decoder seq = { 0 };
WinPrAsn1Decoder seq = { .encoding = WINPR_ASN1_BER, { 0 } };
if (!WinPrAsn1DecReadSequence(&der, &seq))
return FALSE;

View File

@@ -676,7 +676,7 @@ static SECURITY_STATUS SEC_ENTRY negotiate_InitializeSecurityContextW(
PCtxtHandle phNewContext, PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsExpiry)
{
NEGOTIATE_CONTEXT* context = NULL;
NEGOTIATE_CONTEXT init_context = { 0 };
NEGOTIATE_CONTEXT init_context = NEGOTIATE_CONTEXT_init();
MechCred* creds = NULL;
PCtxtHandle sub_context = NULL;
PCredHandle sub_cred = NULL;
@@ -1022,7 +1022,7 @@ static SECURITY_STATUS SEC_ENTRY negotiate_AcceptSecurityContext(
PTimeStamp ptsTimeStamp)
{
NEGOTIATE_CONTEXT* context = NULL;
NEGOTIATE_CONTEXT init_context = { 0 };
NEGOTIATE_CONTEXT init_context = NEGOTIATE_CONTEXT_init();
MechCred* creds = NULL;
PCredHandle sub_cred = NULL;
NegToken input_token = empty_neg_token;

View File

@@ -47,6 +47,17 @@ typedef struct
BOOL spnego;
} NEGOTIATE_CONTEXT;
static inline NEGOTIATE_CONTEXT NEGOTIATE_CONTEXT_init(void)
{
const NEGOTIATE_CONTEXT empty = { .state = NEGOTIATE_STATE_INITIAL,
.sub_context = { 0 },
.mechTypes = { 0 },
.mech = NULL,
.mic = FALSE,
.spnego = FALSE };
return empty;
}
extern const SecPkgInfoA NEGOTIATE_SecPkgInfoA;
extern const SecPkgInfoW NEGOTIATE_SecPkgInfoW;
extern const SecurityFunctionTableA NEGOTIATE_SecurityFunctionTableA;