changed textKeyChain generation > fixed possible buffer overflow
This commit is contained in:
parent
4534ec7521
commit
35959a4393
@ -151,13 +151,13 @@ void generateTextKeyChain(char key[], int *textKeyChain, int textKeyChainSize)
|
|||||||
//FILL textKeyChain
|
//FILL textKeyChain
|
||||||
if ((numberBuffer + 1) % 3 == 0)
|
if ((numberBuffer + 1) % 3 == 0)
|
||||||
{
|
{
|
||||||
textKeyChain[i] = key[numberBuffer] * key[numberBuffer + 1];
|
textKeyChain[i] = key[numberBuffer] * key[numberBuffer + (i < textKeyChainSize)];
|
||||||
} else if ((numberBuffer + 1) % 2 == 0)
|
} else if ((numberBuffer + 1) % 2 == 0)
|
||||||
{
|
{
|
||||||
textKeyChain[i] = key[numberBuffer] - key[numberBuffer + 1];
|
textKeyChain[i] = key[numberBuffer] - key[numberBuffer + (i < textKeyChainSize)];
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
textKeyChain[i] = key[numberBuffer] + key[numberBuffer + 1];
|
textKeyChain[i] = key[numberBuffer] + key[numberBuffer + (i < textKeyChainSize)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user