[Bug 7256] New: vi.c: insert_char accesses memory that may no longer be valid

bugzilla at busybox.net bugzilla at busybox.net
Tue Jul 1 17:22:49 UTC 2014


           Summary: vi.c: insert_char accesses memory that may no longer
                    be valid
           Product: Busybox
           Version: 1.22.x
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
        AssignedTo: unassigned at busybox.net
        ReportedBy: marko.mahnic at gmail.com
                CC: busybox-cvs at busybox.net
   Estimated Hours: 0.0

1. the pointer sp points to p: sp = p;
2. stupid_insert inserts at p which may cause a reallocation of text
3. p is adjusted to the reallocated text
4. sp still points to the old location which is most likely invalid
5. sp is used in: strchr(")]}", *sp), showmatching(sp)

// line 1838
        // insert a char into text[]
        char *sp;        // "save p"

        if (c == 13)
            c = '\n';    // translate \r to \n
        sp = p;            // remember addr of insert
        p += 1 + stupid_insert(p, c);    // insert the char
        if (showmatch && strchr(")]}", *sp) != NULL) {

Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the busybox-cvs mailing list