コード例 #1
0
ファイル: realpath-error.c プロジェクト: wei-wang-523/cascade
int main() {
  char path[MAXPATHLEN];
  char resolved[MAXPATHLEN];

  char * ret = fb_realpath(path, resolved);

}
コード例 #2
0
int main(void) 
{ char pathname[256] ;
  char resolved[256] ;
  int __retres ;
  
  {pathname[256 - 1] = (char)0;
  resolved[256 - 1] = (char)0;
  fb_realpath((char const   *)(pathname), resolved);
  __retres = 0;
  return (__retres);}

}
コード例 #3
0
int main ()
{
  char pathname [MAXPATHLEN];
  char resolved [MAXPATHLEN];

  pathname [MAXPATHLEN-1] = EOS;
  resolved [MAXPATHLEN-1] = EOS;

  fb_realpath(pathname, resolved);

  return 0;
}
コード例 #4
0
ファイル: realpath-ok.c プロジェクト: Locked-Cat/CTES
char *wu_realpath(const char *path, char resolved_path[MAXPATHLEN], char *chroot_path)
{
    char *ptr;
    char q[MAXPATHLEN];
 
    fb_realpath(path, q);  /* call to fb_realpath is made */

    printf("strlen(q) = %d\n", strlen(q));
    printf("q[MAXPATHLEN - 1] = %c\n",q[MAXPATHLEN - 1]);     

    if (chroot_path == NULL)
        strcpy(resolved_path, q);
    else {
        strcpy(resolved_path, chroot_path);
        if (q[0] != '/') {
            if (strlen(resolved_path) + strlen(q) < MAXPATHLEN)
                strcat(resolved_path, q);
            else                /* Avoid buffer overruns... */
                return NULL;
        }
        else if (q[1] != '\0') {
            for (ptr = q; *ptr != '\0'; ptr++);
            if (ptr == resolved_path || *--ptr != '/') {
                if (strlen(resolved_path) + strlen(q) < MAXPATHLEN)
                    strcat(resolved_path, q);
                else            /* Avoid buffer overruns... */
                    return NULL;
            }
            else {
                if (strlen(resolved_path) + strlen(q) - 1 < MAXPATHLEN)
                    strcat(resolved_path, &q[1]);
                else            /* Avoid buffer overruns... */
                    return NULL;
            }
        }
    }

    return resolved_path;
}
コード例 #5
0
ファイル: realpath-error.c プロジェクト: wei-wang-523/cascade
char *wu_realpath(const char *path, char resolved_path[MAXPATHLEN], char *chroot_path)
{
  char *ptr;
  char q[MAXPATHLEN];

  fb_realpath(path, q);

  if (chroot_path == NULL)
    strcpy(resolved_path, q);
  else {
    strcpy(resolved_path, chroot_path);
    if (q[0] != '/') {
      if (strlen(resolved_path) + strlen(q) < MAXPATHLEN)
	strcat(resolved_path, q);
      else		/* Avoid buffer overruns... */
	return NULL;
    }
    else if (q[1] != '\0') {
      ptr = q;
      while (*ptr != '\0') ptr++;
      if (ptr == resolved_path || *--ptr != '/') {
	if (strlen(resolved_path) + strlen(q) < MAXPATHLEN)
	  strcat(resolved_path, q);
	else		/* Avoid buffer overruns... */
	  return NULL;
      }
      else {
	if (strlen(resolved_path) + strlen(q) - 1 < MAXPATHLEN)
	  strcat(resolved_path, &q[1]);
	else		/* Avoid buffer overruns... */
	  return NULL;
      }
    }
  }
  return resolved_path;
}
コード例 #6
0
ファイル: ftpd-20.c プロジェクト: wei-wang-523/cascade
int main() {
  char resolved[MAXPATHLEN];
//  resolved[0] = '\0';
  fb_realpath(resolved);

}