summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-09-22 00:49:06 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-09-22 00:49:06 +0000
commit1e59465c8abdce055fd9cd3b66ea4547c88c688d (patch)
tree53246be958ae3d96d73aeb7ef2ed2c7e178cfdc9 /src
parent38f40eb14d4e1ce626cef7c8400002ec96bbcfa1 (diff)
downloadsmartcardauth-1e59465c8abdce055fd9cd3b66ea4547c88c688d.tar.gz
smartcardauth-1e59465c8abdce055fd9cd3b66ea4547c88c688d.zip
Fix smartauthmon memory corruption due to undersized buffer
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/smartcardauth@1254885 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src')
-rw-r--r--src/smartauthmon.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/smartauthmon.cpp b/src/smartauthmon.cpp
index 0c353ab..3c5dd98 100644
--- a/src/smartauthmon.cpp
+++ b/src/smartauthmon.cpp
@@ -81,11 +81,11 @@ TQString readfile(const char * filename) {
fseek(fp,0,SEEK_END); // Seek to end
len=ftell(fp); // Get position at end (length)
fseek(fp,0,SEEK_SET); // Seek to beginning
- buf=(char *)malloc(len); // Malloc the buffer
+ buf=(char *)malloc(len+1); // Malloc the buffer
fread(buf,len,1,fp); // Read file
fclose(fp);
buf[len]=0;
- TQString contents = TQString(buf);
+ TQString contents(buf);
free(buf); // Free the buffer
return contents;
}