forked from wolfSSL/wolfssl
Modify linked list traversal - fix for compiler bug
KeyShare and PreSharedKey traverse linked list using a handle. Customer reported their compiler couldn't handle the assignment, so, using a temporary.
This commit is contained in:
16
src/tls.c
16
src/tls.c
@ -7540,6 +7540,7 @@ static int TLSX_KeyShare_New(KeyShareEntry** list, int group, void *heap,
|
|||||||
KeyShareEntry** keyShareEntry)
|
KeyShareEntry** keyShareEntry)
|
||||||
{
|
{
|
||||||
KeyShareEntry* kse;
|
KeyShareEntry* kse;
|
||||||
|
KeyShareEntry** next;
|
||||||
|
|
||||||
kse = (KeyShareEntry*)XMALLOC(sizeof(KeyShareEntry), heap,
|
kse = (KeyShareEntry*)XMALLOC(sizeof(KeyShareEntry), heap,
|
||||||
DYNAMIC_TYPE_TLSX);
|
DYNAMIC_TYPE_TLSX);
|
||||||
@ -7550,8 +7551,11 @@ static int TLSX_KeyShare_New(KeyShareEntry** list, int group, void *heap,
|
|||||||
kse->group = (word16)group;
|
kse->group = (word16)group;
|
||||||
|
|
||||||
/* Add it to the back and maintain the links. */
|
/* Add it to the back and maintain the links. */
|
||||||
while (*list != NULL)
|
while (*list != NULL) {
|
||||||
list = &((*list)->next);
|
/* Assign to temporary to work around compiler bug found by customer. */
|
||||||
|
next = &((*list)->next);
|
||||||
|
list = next;
|
||||||
|
}
|
||||||
*list = kse;
|
*list = kse;
|
||||||
*keyShareEntry = kse;
|
*keyShareEntry = kse;
|
||||||
|
|
||||||
@ -8318,6 +8322,7 @@ static int TLSX_PreSharedKey_New(PreSharedKey** list, byte* identity,
|
|||||||
PreSharedKey** preSharedKey)
|
PreSharedKey** preSharedKey)
|
||||||
{
|
{
|
||||||
PreSharedKey* psk;
|
PreSharedKey* psk;
|
||||||
|
PreSharedKey** next;
|
||||||
|
|
||||||
psk = (PreSharedKey*)XMALLOC(sizeof(PreSharedKey), heap, DYNAMIC_TYPE_TLSX);
|
psk = (PreSharedKey*)XMALLOC(sizeof(PreSharedKey), heap, DYNAMIC_TYPE_TLSX);
|
||||||
if (psk == NULL)
|
if (psk == NULL)
|
||||||
@ -8334,8 +8339,11 @@ static int TLSX_PreSharedKey_New(PreSharedKey** list, byte* identity,
|
|||||||
psk->identityLen = len;
|
psk->identityLen = len;
|
||||||
|
|
||||||
/* Add it to the end and maintain the links. */
|
/* Add it to the end and maintain the links. */
|
||||||
while (*list != NULL)
|
while (*list != NULL) {
|
||||||
list = &((*list)->next);
|
/* Assign to temporary to work around compiler bug found by customer. */
|
||||||
|
next = &((*list)->next);
|
||||||
|
list = next;
|
||||||
|
}
|
||||||
*list = psk;
|
*list = psk;
|
||||||
*preSharedKey = psk;
|
*preSharedKey = psk;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user