Message308697
In function ‘wcsncpy’,
inlined from ‘calculate_zip_path’ at ./Modules/getpath.c:797:5:
/usr/include/x86_64-linux-gnu/bits/wchar2.h:200:9: warning: call to ‘__wcsncpy_chk_warn’ declared with attribute warning: wcsncpy called with length bigger than size of destination buffer
return __wcsncpy_chk_warn (__dest, __src, __n,
^
Line 797:
wcsncpy(calculate->zip_path, prefix, MAXPATHLEN);
calculate type is "PyCalculatePath *" which is defined as:
typedef struct {
...
wchar_t zip_path[MAXPATHLEN+1]; /* ".../lib/pythonXY.zip" */
...
} PyCalculatePath;
Earlier, all bytes are set to 0:
memset(&calculate, 0, sizeof(calculate));
So I don't see how wcsncpy() can overflow.
By the way, I'm unable to reproduce the warning on Fedora 27 with GCC 7.2.1. Are you using -D_FORTIFY_SOURCE=1? Are you compiling Python in release mode? Can you try to find the command line compiling getpath.c? |
|
Date |
User |
Action |
Args |
2017-12-20 00:25:58 | vstinner | set | recipients:
+ vstinner, pitrou, serhiy.storchaka |
2017-12-20 00:25:58 | vstinner | set | messageid: <1513729558.64.0.213398074469.issue32375@psf.upfronthosting.co.za> |
2017-12-20 00:25:58 | vstinner | link | issue32375 messages |
2017-12-20 00:25:58 | vstinner | create | |
|