/[pdpsoft]/trunk/grid-mw-security/cgul/realpath/realpath.c
ViewVC logotype

Diff of /trunk/grid-mw-security/cgul/realpath/realpath.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1888 by msalle, Thu Aug 19 14:30:13 2010 UTC revision 1889 by msalle, Fri Aug 20 09:21:16 2010 UTC
# Line 111  char *cgul_realpath(const char *inpath, Line 111  char *cgul_realpath(const char *inpath,
111              if (errno==ERANGE) errno=ENAMETOOLONG;              if (errno==ERANGE) errno=ENAMETOOLONG;
112              return NULL;              return NULL;
113          }          }
114          if ( (pathlen=snprintf(path,PATH_MAX,"%s/%s",buf,inpath))>PATH_MAX ) {          /* Note: snprintf retval excludes \0 */
115            if ( (pathlen=snprintf(path,PATH_MAX,"%s/%s",buf,inpath))>=PATH_MAX ) {
116              errno=ENAMETOOLONG;              errno=ENAMETOOLONG;
117              return NULL;              return NULL;
118          }          }
# Line 158  char *cgul_realpath(const char *inpath, Line 159  char *cgul_realpath(const char *inpath,
159      /* Put them together, canonicdir doesn't end with a / */      /* Put them together, canonicdir doesn't end with a / */
160      pathlen=snprintf(buf,PATH_MAX,"%s/%s",canonicdir,pos+1);      pathlen=snprintf(buf,PATH_MAX,"%s/%s",canonicdir,pos+1);
161      free(canonicdir); /* Done with canonicdir */      free(canonicdir); /* Done with canonicdir */
162      if (pathlen>PATH_MAX)   {      /* Note: snprintf retval excludes \0 */
163        if (pathlen>=PATH_MAX)   {
164          errno=ENAMETOOLONG;          errno=ENAMETOOLONG;
165          return NULL;          return NULL;
166      }      }

Legend:
Removed from v.1888  
changed lines
  Added in v.1889

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28