Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!apollo!vinoski From: vinoski@apollo.HP.COM (Stephen Vinoski) Newsgroups: comp.lang.perl Subject: input trashing bug in str.c Message-ID: <4e10c201.20b6d@apollo.HP.COM> Date: 17 Nov 90 18:59:00 GMT Sender: root@apollo.HP.COM Organization: Hewlett-Packard Apollo Division - Chelmsford, MA Lines: 27 Enclosed is an unofficial patch for a bug in str_gets() in str.c @ pl41. The bug can cause input to be trashed. As far as I can tell the bug has been around for awhile; I've checked all patches back to pl29 and it doesn't appear that any of them introduced it. -steve *** str.c.old Fri Nov 16 20:23:48 1990 --- str.c Sat Nov 17 12:32:11 1990 *************** *** 804,809 **** --- 804,810 ---- if (get_paragraph && oldbp) obpx = oldbp - str->str_ptr; bpx = bp - str->str_ptr; /* prepare for possible relocation */ + str->str_cur = bpx; STR_GROW(str, str->str_len + append + cnt + 2); bp = str->str_ptr + bpx; /* reconstitute our pointer */ if (get_paragraph && oldbp) | Steve Vinoski (508)256-6600 x5904 | Internet: vinoski@apollo.hp.com | | Testability and Diagnostics | UUCP: ...mit-eddie!apollo!vinoski| | HP Apollo Division, Chelmsford, MA 01824 | ...uw-beaver!apollo!vinoski| | I feel crapulous today. |