Changeset 871 for trunk/dll/saveclip.c


Ignore:
Timestamp:
Nov 17, 2007, 2:13:23 AM (18 years ago)
Author:
Steven Levine
Message:

Correct hex edit buffer sizing to avoid data loss
Detect and report overflows in fixup()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/saveclip.c

    r847 r871  
    1919  20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat
    2020  27 Sep 07 SHL Correct ULONGLONG size formatting
     21  16 Nov 07 SHL Ensure fixup buffer sufficiently large
    2122
    2223***********************************************************************/
     
    3839
    3940static PSZ pszSrcFile = __FILE__;
     41#define MAX_PATTERN_BYTES 80
    4042
    4143BOOL SaveToClip(HWND hwnd, CHAR * text, BOOL append)
     
    216218        PrfQueryProfileData(fmprof,
    217219                            appname, "SaveToListName", savename, &size);
    218         size = 81;
     220        size = MAX_PATTERN_BYTES + 1;
    219221        PrfQueryProfileData(fmprof,
    220222                            appname, "SaveToListPattern", pattern, &size);
     
    224226        strcpy(pattern, "%F  %s");
    225227      {
    226         CHAR temp[162];
     228        CHAR temp[MAX_PATTERN_BYTES * 4 + 1];
    227229
    228230        fixup(pattern, temp, sizeof(temp), strlen(pattern));
     
    574576        PrfQueryProfileData(fmprof,
    575577                            appname, "SaveToListName", savename, &size);
    576         size = 81;
     578        size = MAX_PATTERN_BYTES + 1;
    577579        PrfQueryProfileData(fmprof,
    578580                            appname, "SaveToListPattern", pattern, &size);
     
    582584        strcpy(pattern, "%F  %s");
    583585      {
    584         CHAR temp[162];
     586        CHAR temp[MAX_PATTERN_BYTES * 4 + 1];
    585587
    586588        fixup(pattern, temp, sizeof(temp), strlen(pattern));
Note: See TracChangeset for help on using the changeset viewer.