[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdelibs/libkmid [POSSIBLY UNSAFE]
From: Waldo Bastian <bastian () kde ! org>
Date: 2002-12-07 16:39:49
[Download RAW message or body]
CVS commit by waba:
Proper string handling. Patch by Peter Hawkins <peter@hawkins.emu.id.au>
M +7 -6 fmout.cc 1.20 [POSSIBLY UNSAFE]
--- kdelibs/libkmid/fmout.cc:1.19 Tue Oct 10 00:09:23 2000
@@ -34,6 +34,7 @@
#include <string.h>
#include <sys/param.h>
#include <stdlib.h>
+#include <limits.h>
#include "midispec.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -126,8 +127,8 @@
void FMOut::loadFMPatches(void)
{
#ifdef HAVE_OSS_SUPPORT
- char patchesfile[120];
- char drumsfile[120];
+ char patchesfile[PATH_MAX];
+ char drumsfile[PATH_MAX];
int size;
struct sbi_instrument instr;
char tmp[60];
@@ -140,12 +141,12 @@
if (opl==3)
{
- sprintf(patchesfile,"%s/std.o3",FMPatchesDirectory);
+ snprintf(patchesfile, PATH_MAX, "%s/std.o3",FMPatchesDirectory);
size=60;
}
else
{
- sprintf(patchesfile,"%s/std.sb",FMPatchesDirectory);
+ snprintf(patchesfile, PATH_MAX, "%s/std.sb",FMPatchesDirectory);
size=52;
}
fh=fopen(patchesfile,"rb");
@@ -170,11 +171,11 @@
if (opl==3)
{
- sprintf(drumsfile,"%s/drums.o3",FMPatchesDirectory);
+ snprintf(drumsfile, PATH_MAX, "%s/drums.o3",FMPatchesDirectory);
}
else
{
- sprintf(drumsfile,"%s/drums.sb",FMPatchesDirectory);
+ snprintf(drumsfile, PATH_MAX, "%s/drums.sb",FMPatchesDirectory);
}
fh=fopen(drumsfile,"rb");
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic