diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2001-06-12 00:29:20 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-06-12 00:29:20 +0000 |
commit | d05c1ba08d199ec5bed1e39e74e1c4c0f8d726b6 (patch) | |
tree | 7a7b729922fd23d80bf3ffaa2ea202c204ebc501 /util.c | |
parent | 4fca3945e6d50f55c1660233803e96a8edddd182 (diff) | |
download | perl-d05c1ba08d199ec5bed1e39e74e1c4c0f8d726b6.tar.gz |
gcc -Wall nits picked out by a non-UNIX system
(courtesy of Mark Bixby)
p4raw-id: //depot/perl@10524
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -4941,14 +4941,16 @@ Perl_sv_realpath(pTHX_ SV *sv, char *path, STRLEN len) char name[MAXPATHLEN] = { 0 }, *s; STRLEN pathlen, namelen; + /* Don't use strlen() to avoid running off the end. */ + s = memchr(path, '\0', MAXPATHLEN); + pathlen = s ? s - path : MAXPATHLEN; + #ifdef HAS_REALPATH + /* Be paranoid about the use of realpath(), * it is an infamous source of buffer overruns. */ - /* Is the source buffer too long? - * Don't use strlen() to avoid running off the end. */ - s = memchr(path, '\0', MAXPATHLEN); - pathlen = s ? s - path : MAXPATHLEN; + /* Is the source buffer too long? */ if (pathlen == MAXPATHLEN) { Perl_warn(aTHX_ "sv_realpath: realpath(\"%s\"): %c= (MAXPATHLEN = %d)", path, s ? '=' : '>', MAXPATHLEN); |