topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday December 12, 2024, 12:31 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: small file name length-related bug  (Read 4173 times)

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,261
    • View Profile
    • Donate to Member
small file name length-related bug
« on: November 25, 2011, 06:30 AM »
The longest name an image can have in SC's left column (the path being M:\ScreenshotCaptor\) is

1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345.png

But in the "Name:" area towards the bottom of SC's window, the max length is this:

1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890.png

Trying to enter a longer name there just won't work.
« Last Edit: November 25, 2011, 06:36 AM by brotherS »

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,629
    • View Profile
    • Donate to Member
Re: small file name length-related bug
« Reply #1 on: November 25, 2011, 07:12 AM »
Looks like a typo in de code, the max normal path/filename is 261 characters, while SC allows for 161, dodgy or on purpose?

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: small file name length-related bug
« Reply #2 on: November 26, 2011, 10:34 AM »
Looks like a typo in de code, the max normal path/filename is 261 characters, while SC allows for 161, dodgy or on purpose?
259, actually - MAX_PATH is 260, and one character is reserved for the NUL. (Yes, reserving MAX_PATH+1 characters for buffers is useless).
- carpe noctem

db90h

  • Coding Snacks Author
  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 481
  • Software Engineer
    • View Profile
    • Bitsum - Take control of your PC
    • Read more about this member.
    • Donate to Member
Re: small file name length-related bug
« Reply #3 on: November 27, 2011, 11:59 PM »
He may have been reserving space for the folder name, and haphazardly picked MAX_PATH-100 as a limit on the file base name. Who knows.

Did you set out to find this bug looking for a buffer overflow, or accidentally?

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,261
    • View Profile
    • Donate to Member
Re: small file name length-related bug
« Reply #4 on: November 28, 2011, 02:07 AM »
I found the bug because I sometimes like to use very long filenames. :Thmbsup: