diff --git a/src/internal.c b/src/internal.c index 7856abb24b..f98a618829 100644 --- a/src/internal.c +++ b/src/internal.c @@ -41409,8 +41409,7 @@ static int DefTicketEncCb(WOLFSSL* ssl, byte key_name[WOLFSSL_TICKET_NAME_SZ], ret = args->lastErr; args->lastErr = 0; /* reset */ /* On error 'ret' will be negative */ - mask = ((byte)ret >> - ((sizeof(ret) * 8) - 1)) - 1; + mask = (byte)((ret >> ((sizeof(ret) * 8) - 1)) & 0xFF) - 1; /* build PreMasterSecret */ ssl->arrays->preMasterSecret[0] = ssl->chVersion.major;