diff options
author | Vern Paxson <vern@ee.lbl.gov> | 1994-12-03 11:26:51 +0000 |
---|---|---|
committer | Vern Paxson <vern@ee.lbl.gov> | 1994-12-03 11:26:51 +0000 |
commit | 585dbc08504da06e156b385615f4b11a50d55d3d (patch) | |
tree | 7de417aa11b917104f31587abe0ed90e73ea6497 /misc.c | |
parent | 10b195c219b555ee449c913372193b143b672776 (diff) |
Increase slowly if realloc double overflows
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -63,7 +63,16 @@ char *new_text; while ( len + action_index >= action_size - 10 /* slop */ ) { - action_size *= 2; + int new_size = action_size * 2; + + if ( new_size <= 0 ) + /* Increase just a little, to try to avoid overflow + * on 16-bit machines. + */ + action_size += action_size / 8; + else + action_size = new_size; + action_array = reallocate_character_array( action_array, action_size ); } |