On 05/21/2016 05:05 PM, Dimitry Sibiryakov wrote: > Hello, All. > > In config_file.cpp I see following piece of code: > >> if (PathUtils::isSymLink(tempPath)) >> { >> // If $(this) is a symlink, expand it. >> TEXT temp[MAXPATHLEN]; >> const int n = readlink(fileName, temp, sizeof(temp)); >> >> if (n != -1 && unsigned(n) < sizeof(temp)) >> { >> tempPath = temp; > According to man pages, readlink() doesn't terminate string with null. > Why this > assignment doesn't crash? >
Looks like stack use to be zero-initialized. A routine: void main() { char s[255]; int n; memset(s, 'X', 255); s[254] = 0; n = readlink("libfbclient.so", s, 255); printf("%d %s\n", n, s); } prints: 16 libfbclient.so.2XXXXXXXXXXXXXXXXXXXXXXXX... (as expected) but if I comment out memset() I always get: 16 libfbclient.so.2 Certainly it's not a reason to keep this unfixed. ------------------------------------------------------------------------------ Mobile security can be enabling, not merely restricting. Employees who bring their own devices (BYOD) to work are irked by the imposition of MDM restrictions. Mobile Device Manager Plus allows you to control only the apps on BYO-devices by containerizing them, leaving personal data untouched! https://ad.doubleclick.net/ddm/clk/304595813;131938128;j Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel