diff options
author | Jonathan McCrohan <jmccrohan@gmail.com> | 2012-10-30 21:33:07 +0000 |
---|---|---|
committer | Jonathan McCrohan <jmccrohan@gmail.com> | 2012-10-30 21:33:07 +0000 |
commit | 51677095c675a778c53580589270203930c61a87 (patch) | |
tree | ae4c7470d8ecdac8cbcec313d2c0738f1b6929cf /buffers.c | |
parent | b870e05547bc189f29569a5d21db0c875c8f9983 (diff) | |
download | dhex-51677095c675a778c53580589270203930c61a87.tar.gz |
Imported Upstream version 0.68upstream/0.68upstream
Diffstat (limited to '')
-rw-r--r-- | buffers.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -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) { |