Browse code

bb11946 - check that tar checksum is within bounds. Patch supplied by Suleman Ali.

Steven Morgan authored on 2017/10/28 05:03:29
Showing 1 changed files
... ...
@@ -182,6 +182,9 @@ cli_untar(const char *dir, unsigned int posix, cli_ctx *ctx)
182 182
 			if((ret=cli_checklimits("cli_untar", ctx, 0, 0, 0))!=CL_CLEAN)
183 183
 				return ret;
184 184
 
185
+                        if (nread < TARCHECKSUMOFFSET + TARCHECKSUMLEN)
186
+                            return ret;
187
+
185 188
 			checksum = getchecksum(block);
186 189
 			cli_dbgmsg("cli_untar: Candidate checksum = %d, [%o in octal]\n", checksum, checksum);
187 190
 			if(testchecksum(block, checksum) != 0) {