set new query[240] to new query[1024] for example.
And why are you not using SHA1() to hash passwords?
Anyway try to set the string larger.
Isn't 1024 a bit over the top? He only needs 247 + whatever the maximum length of salt[] is - which I have no knowledge of - which I believe won't be over 200 cells big.