Thread: Directory traversal problem

  1. #1
    Registered User
    Join Date
    Mar 2009

    Directory traversal problem

    Last edited by phlook; 03-16-2009 at 12:30 AM. Reason: completed

  2. #2
    Registered User
    Join Date
    Sep 2007
    But return_dir is not initialized. Trying to write there is undefined, and can cause real problems.

    Once you fix that, I'm not sure what precisely your program is trying to do. But there's an issue with this:
    dir_path = strcat(dir,"/");
    dir_path = strcat(dir_path,dp->d_name);
    Here you are modifying the string contained in dir. This means you are modifying the original string as passed to the function. An easy way around this is something like:
    ff_gather(data, dp->d_name);
    and nothing else inside your if block.

    Whether this works depends on your needs.

  3. #3
    Registered User
    Join Date
    Mar 2009
    you are a saviour. why didn't i think of that sooner?!


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Directory traversal issue
    By Mostly Harmless in forum Windows Programming
    Replies: 5
    Last Post: 12-21-2007, 12:44 PM
  2. C/C++ String Problem.
    By Jaken Veina in forum C++ Programming
    Replies: 7
    Last Post: 07-09-2005, 10:11 PM
  3. Replies: 6
    Last Post: 07-30-2003, 03:08 AM
  4. Need Help
    By GSLR in forum C Programming
    Replies: 1
    Last Post: 02-05-2002, 12:20 PM
  5. The Site Directory
    By kermi3 in forum A Brief History of
    Replies: 6
    Last Post: 01-22-2002, 08:19 PM