diff options
| author | Iain R. Learmonth <irl@debian.org> | 2015-10-18 18:51:00 +0100 |
|---|---|---|
| committer | Iain R. Learmonth <irl@debian.org> | 2015-10-18 18:51:00 +0100 |
| commit | d63dd8d081a6fcd0715cd13f26df59fb831769d2 (patch) | |
| tree | b9c1f6245147a310aac3762630bad389bbb57335 /getfile.cpp | |
| parent | c720a3d55c5ec832c29cb7ce50b6fb4b70c55b11 (diff) | |
Imported Upstream version 1.5.0upstream/1.5.0
Diffstat (limited to 'getfile.cpp')
| -rw-r--r-- | getfile.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/getfile.cpp b/getfile.cpp index ecc7bbb6..cf1dfa9a 100644 --- a/getfile.cpp +++ b/getfile.cpp @@ -19,8 +19,10 @@ void getfile(QString fname, int ntrperiod) { - char name[80]; - strcpy(name,fname.toLatin1()); + char name[512]; + strncpy(name,fname.toLatin1(), sizeof (name) - 1); + name[sizeof (name) - 1] = '\0'; + FILE* fp=fopen(name,"rb"); int i0=fname.indexOf(".wav"); @@ -60,8 +62,9 @@ void savewav(QString fname, int ntrperiod) int npts=ntrperiod*12000; // qint16* buf=(qint16*)malloc(2*npts); - char name[80]; - strcpy(name,fname.toLatin1()); + char name[512]; + strncpy(name,fname.toLatin1(),sizeof (name) - 1); + name[sizeof (name) - 1] = '\0'; FILE* fp=fopen(name,"wb"); if(fp != NULL) { |
