On 12/19/2008 at 3:32 PM, "K.R. Foley"
wrote: ########## In function 'char* strncpy(char*, const char*, size_t)', inlined from 'void PATinst(INSTRUMENTHEADER*, int, int)' at load_pat.cpp:1147, inlined from 'BOOL PAT_Load_Instruments(void*)' at load_pat.cpp:1321: /usr/include/bits/string3.h:122: warning: call to char* __builtin___strncpy_chk(char*, const char*, unsigned int, unsigned int) will always overflow destinat ion buffer ########### This looks to me like the overflow is happening somewhere in the code of PATinst(of->Headers[t], t, pat_smptogm(t));
which we can't see from his posting.
Thanks... I 'interpret' that giving the function PATinst might sched some more light on the case, so here it is... (sorry, it's long) #ifdef NEWMIKMOD static void PATinst(UNIMOD *of, INSTRUMENT *d, int smp, int gm) #else static void PATinst(INSTRUMENTHEADER *d, int smp, int gm) #endif { WaveHeader hw; char s[32]; memset(s,0,32); if( pat_readpat_attr(gm-1, &hw, 0) ) { pat_setpat_inst(&hw, d, smp); } else { hw.modes = PAT_16BIT|PAT_ENVELOPE|PAT_SUSTAIN|PAT_LOOP; hw.start_loop = 0; hw.end_loop = 30000; hw.wave_size = 30000; // envelope rates and offsets pinched from timidity's acpiano.pat sample no 1 hw.envelope_rate[0] = 0x3f; hw.envelope_rate[1] = 0x3f; hw.envelope_rate[2] = 0x3f; hw.envelope_rate[3] = 0x08|(3<<6); hw.envelope_rate[4] = 0x3f; hw.envelope_rate[5] = 0x3f; hw.envelope_offset[0] = 246; hw.envelope_offset[1] = 246; hw.envelope_offset[2] = 246; hw.envelope_offset[3] = 0; hw.envelope_offset[4] = 0; hw.envelope_offset[5] = 0; strncpy(hw.reserved, midipat[gm-1], 36); pat_setpat_inst(&hw, d, smp); } if( hw.reserved[0] ) strncpy(s, hw.reserved, 32); else strncpy(s, midipat[gm-1], 32); #ifdef NEWMIKMOD d->insname = DupStr(of->allochandle, s,28); #else s[31] = '\0'; memset(d->name, 0, 32); strcpy((char *)d->name, s); strncpy(s, midipat[gm-1], 12); s[11] = '\0'; memset(d->filename, 0, 12); strcpy((char *)d->filename, s); #endif } Dominique -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-programming+help@opensuse.org