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; }