DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: small file name length-related bug  (Read 5,325 times)

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,261
small file name length-related bug
« on: November 25, 2011, 12:30 PM »
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.
Thank you.
« Last Edit: November 25, 2011, 12:36 PM by brotherS »

Ath

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 3,649
    • Participated in NANY Challenge Eleven Times
    • Coding Snacks
    • Linux User
    • Hardware Hacker
Re: small file name length-related bug
« Reply #1 on: November 25, 2011, 01:12 PM »
Looks like a typo in de code, the max normal path/filename is 261 characters, while SC allows for 161, dodgy or on purpose?
/Ton
Ath's software collection, Quote: "A problem well stated is a problem half-solved." (Charles Kettering)

f0dder

  • [Well, THAT escalated quickly!]
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
    • Participated in NANY Challenge Once
Re: small file name length-related bug
« Reply #2 on: November 26, 2011, 04:34 PM »
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
  • ***
  • Posts: 481
    • Coding Snacks
    • Military Service Badge - US Army
    • Linux User
Re: small file name length-related bug
« Reply #3 on: November 28, 2011, 05:59 AM »
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
Re: small file name length-related bug
« Reply #4 on: November 28, 2011, 08:07 AM »
I found the bug because I sometimes like to use very long filenames. :Thmbsup:
Thank you.

Original address: https://www.donationcoder.com/forum/index.php?topic=28847.0