Menu

#4 execution abort, FYI.

1.0
closed
nobody
None
2018-01-26
2017-12-17
No

My attempts to build and run BackupBand from the source were consistently terminatinh with a:
*** buffer overflow detected ***: ./BackupBand terminated

That appears to be because my (glibc?) library's strcpy() is smarter than the average and refuses to write if it thinks the destination string is too small for the data.

As a workaround or possible step towards a fix, for the present I've done the following:

#pragma pack(1)

typedef struct {
    STYLE_VARIATION *       BassPtns[5];
    STYLE_VARIATION *       GtrPtns[5];
    STYLE_VARIATION *       DrumPtns[5];
    unsigned char           StyleFlags;
    unsigned char           BassPgm;
    unsigned char           GtrPgm;
    unsigned char           DrumPgm;
    unsigned char           Tempo;
    unsigned char           MeasureLen;
    //char                      Name[1];
        char                        Name[64];// <-------
} STYLE;

struct STYLEHEAD {
    struct STYLEHEAD *  Next;
    STYLE                       Style;
};

Whether that is a best-choice fix is moot.
I'd previously tried an abstracted pointer, but it still aborted, so in this instance, the library appears "too clever by half".

Discussion

  • jeff

    jeff - 2018-01-16
    I replaced the strlen's with memcpy. That should bypass gcc's overly aggressive buffer checking. I deliberately called strlen, not nstrlen. Gcc shouldn't be substituting.
    
     
  • jeff

    jeff - 2018-01-26
    • status: open --> closed
     

Log in to post a comment.