On Wed, 2 Dec 2020 16:43:11 -0800, Charles Mills <charl...@mcn.org> wrote:
>This code has been changed since I last compiled it on Z but I don't think I >changed that reference. It appears that PATH_MAX went away somewhere between >V2R2 and V2R4. I see some comments in limits.h that are consistent with that. > Longer, I think. My utility realpath.c is dated 2012. (I recompiled it on Mac OS and pedantic C issued 3 warnings; one a genuine error in an unlikely path.) >I picked up _POSIX_PATH_MAX from limits.h. I am running POSIX(ON). It that a >valid maximum path length or am I likely to get whacked with a buffer overflow? > >Re-stating the question, what is the maximum path length on z/OS UNIX? Can it >really be true that there is no hard maximum? I really have to ask pathconf() >every time? No maximum of possible maximums? The maximum is really whatever >z/OS wants it to be today? > Alas, I suspect yes. Single UNIX says: https://pubs.opengroup.org/onlinepubs/9699919799/functions/realpath.html#tag_16_479_03 If resolved_name is a null pointer, the generated pathname shall be stored as a null-terminated string in a buffer allocated as if by a call to malloc(). ... If the resolved_name argument is a null pointer, the pointer returned by realpath() can be passed to free(). (Probably a good idea.) But z/OS XL C C++: EINVAL [the] resolved_name argument is a NULL pointer. I suspect the concern may be that in the future the constraint may be relaxed but you'll run a dusty program object allocating a static resolved_name and incur a buffer overrun. >What is FILENAME_MAX, referenced in >https://www.ibm.com/support/knowledgecenter/en/SSLTBW_2.4.0/com.ibm.zos.v2r4.bpxbd00/fldata.htm > ? > Don't know. Can that be misused to incur a buffer overflow? I suppose if you parse a pathname and copy a component into a static char[ FILENAME_MAX ]. -- gil ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN