comparison sub/unrar_exec.c @ 35883:804c3926503b

Fix a potential integer overflow.
author reimar
date Sat, 16 Mar 2013 10:32:42 +0000
parents 22888a8cb312
children
comparison
equal deleted inserted replaced
35882:6bdb39d9a114 35883:804c3926503b
114 if (bytesread <= 0) 114 if (bytesread <= 0)
115 break; 115 break;
116 *size += bytesread; 116 *size += bytesread;
117 if (*size == bufsize) { 117 if (*size == bufsize) {
118 char *p; 118 char *p;
119 if (bufsize >= 0x7fffffff - ALLOC_INCR)
120 break;
119 bufsize += ALLOC_INCR; 121 bufsize += ALLOC_INCR;
120 p = realloc(*output, bufsize); 122 p = realloc(*output, bufsize);
121 if (!p) 123 if (!p)
122 free(*output); 124 free(*output);
123 *output = p; 125 *output = p;