Skip to content

Commit dc7b82c

Browse files
Merge pull request vgmstream#938 from NicknineTheEagle/desc-fix
Properly initialize input buffer in describe_vgmstream
2 parents 7637a9c + c386b82 commit dc7b82c

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

src/vgmstream.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -911,6 +911,8 @@ void describe_vgmstream(VGMSTREAM* vgmstream, char* desc, int length) {
911911
char temp[TEMPSIZE];
912912
double time_mm, time_ss;
913913

914+
desc[0] = '\0';
915+
914916
if (!vgmstream) {
915917
snprintf(temp,TEMPSIZE, "NULL VGMSTREAM");
916918
concatn(length,desc,temp);

winamp/in_vgmstream.c

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -539,17 +539,15 @@ void winamp_SetPan(int pan) {
539539
/* display info box (ALT+3) */
540540
int winamp_InfoBox(const in_char *fn, HWND hwnd) {
541541
char description[1024] = {0}, tmp[1024] = {0};
542-
size_t description_size = 1024;
542+
TCHAR tbuf[1024] = {0};
543543
double tmpVolume = 1.0;
544544

545-
concatn(description_size,description,PLUGIN_INFO "\n\n");
546-
547545
if (!fn || !*fn) {
548546
/* no filename = current playing file */
549547
if (!vgmstream)
550548
return 0;
551549

552-
describe_vgmstream(vgmstream,description,description_size);
550+
describe_vgmstream(vgmstream,description,sizeof(description));
553551
}
554552
else {
555553
/* some other file in playlist given by filename */
@@ -569,24 +567,21 @@ int winamp_InfoBox(const in_char *fn, HWND hwnd) {
569567
vgmstream_mixing_autodownmix(infostream, settings.downmix_channels);
570568
vgmstream_mixing_enable(infostream, 0, NULL, NULL);
571569

572-
describe_vgmstream(infostream,description,description_size);
570+
describe_vgmstream(infostream,description,sizeof(description));
573571

574572
close_vgmstream(infostream);
575573
infostream = NULL;
576574
tmpVolume = get_album_gain_volume(fn);
577575
}
578576

577+
snprintf(tmp, sizeof(tmp), "\nvolume: %.6f\n", tmpVolume);
578+
concatn(sizeof(description), description, tmp);
579579

580-
{
581-
TCHAR buf[1024] = {0};
582-
size_t buf_size = 1024;
580+
concatn(sizeof(description), description, "\n" PLUGIN_INFO);
583581

584-
snprintf(tmp, sizeof(tmp), "\nvolume: %.6f", tmpVolume);
585-
concatn(description_size, description, tmp);
582+
cfg_char_to_wchar(tbuf, sizeof(tbuf) / sizeof(TCHAR), description);
583+
MessageBox(hwnd, tbuf, TEXT("Stream info"), MB_OK);
586584

587-
cfg_char_to_wchar(buf, buf_size, description);
588-
MessageBox(hwnd,buf,TEXT("Stream info"),MB_OK);
589-
}
590585
return 0;
591586
}
592587

0 commit comments

Comments
 (0)