diff options
Diffstat (limited to 'linden/indra/lscript/lscript_execute/lscript_execute.cpp')
-rw-r--r-- | linden/indra/lscript/lscript_execute/lscript_execute.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/linden/indra/lscript/lscript_execute/lscript_execute.cpp b/linden/indra/lscript/lscript_execute/lscript_execute.cpp index 2f81416..9e8be15 100644 --- a/linden/indra/lscript/lscript_execute/lscript_execute.cpp +++ b/linden/indra/lscript/lscript_execute/lscript_execute.cpp | |||
@@ -63,11 +63,19 @@ LLScriptExecute::LLScriptExecute(FILE *fp) | |||
63 | U8 sizearray[4]; | 63 | U8 sizearray[4]; |
64 | S32 filesize; | 64 | S32 filesize; |
65 | S32 pos = 0; | 65 | S32 pos = 0; |
66 | fread(&sizearray, 1, 4, fp); | 66 | if (fread(&sizearray, 1, 4, fp) != 4) |
67 | filesize = bytestream2integer(sizearray, pos); | 67 | { |
68 | llwarns << "Short read" << llendl; | ||
69 | filesize = 0; | ||
70 | } else { | ||
71 | filesize = bytestream2integer(sizearray, pos); | ||
72 | } | ||
68 | mBuffer = new U8[filesize]; | 73 | mBuffer = new U8[filesize]; |
69 | fseek(fp, 0, SEEK_SET); | 74 | fseek(fp, 0, SEEK_SET); |
70 | fread(mBuffer, 1, filesize, fp); | 75 | if (fread(mBuffer, 1, filesize, fp) != filesize) |
76 | { | ||
77 | llwarns << "Short read" << llendl; | ||
78 | } | ||
71 | fclose(fp); | 79 | fclose(fp); |
72 | 80 | ||
73 | init(); | 81 | init(); |