Netrek Server
The previous code presumed that a `saltbuf` parameter would be passed as `char[3]` rather than `char*`, and incorrectly calculated the salt length as `size(char*)-2`. On a 32-bit platform, this would result in `2`, which is the correct answer. However, on a 64-bit platform, it would result in `6`, which is not the correct answer. GCC warned about this. With -Werror, it reported: ``` salt.c: In function ‘salt’: salt.c:24:25: error: ‘sizeof’ on array function parameter ‘sb’ will return size of ‘char *’ [-Werror=sizeof-array-argument] int saltlen = sizeof(sb) - 2; ^ salt.c:20:35: note: declared here char* salt(const char* s, saltbuf sb) ^ cc1: all warnings being treated as errors ``` As crypt() only looks for the first two bytes to use as salt, this may not have lead to a change in crypt() calculation. However, writing 7 bytes to a buffer that is only 3 bytes in length may lead to a buffer overflow.
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be resolved. The issue was opened by MarkMielke and has received 3 comments.