aboutsummaryrefslogtreecommitdiffstats
path: root/buffers.c
diff options
context:
space:
mode:
authorJonathan McCrohan <jmccrohan@gmail.com>2012-10-30 21:33:07 +0000
committerJonathan McCrohan <jmccrohan@gmail.com>2012-10-30 21:33:07 +0000
commit1e48d23e4b624c92865897373f4dd16ea01767ea (patch)
treeafb3f8bf4880e3493229e7fd7f4eecac6320bf8e /buffers.c
parent4247b0208aea6c1251eca8bf138a3986671da2bb (diff)
parent51677095c675a778c53580589270203930c61a87 (diff)
downloaddhex-1e48d23e4b624c92865897373f4dd16ea01767ea.tar.gz
Merge tag 'upstream/0.68'
Upstream version 0.68
Diffstat (limited to '')
-rw-r--r--buffers.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/buffers.c b/buffers.c
index 5f196ea..f19d885 100644
--- a/buffers.c
+++ b/buffers.c
@@ -13,11 +13,20 @@
//
tUInt32 openbuf(tBuffer* hBuf,tUInt8 bufnum,char* filename)
{
+ unsigned int filenamelen=0;
+ if (filename == NULL)
+ return RETNOK;
+
+ filenamelen=strlen(filename);
+ if (filenamelen>510)
+ filenamelen=510;
+
hBuf->changesnum=0;
hBuf->valid=0;
hBuf->fresh=1;
hBuf->file=fopen(filename,"rb");
- memcpy(hBuf->filename,filename,512);
+ memcpy(hBuf->filename,filename,filenamelen+1);
+
hBuf->filename[511]=0;
if (hBuf->file)
{