call_jio_print ignores its "len" argument

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • hs10
    • Affects Version/s: 7
    • Component/s: hotspot
    • None
    • b14
    • generic
    • generic

        call_jio_print(const char* s, size_t len) exists because jio_print(const char* s) doesn't take a length argument, instead assuming that its argument is null-terminated. call_jio_print carefully allocates a buffer, copies the correct number of characters from its argument to the buffer, null-terminates the buffer, and (but!) then hands the source argument to jio_print, which prints until it finds a null terminator.

        In the most benign case, if the argument happens to be null-terminated in the right place, the correct result is produced. If the argument continues on past the given number of characters (e.g., it's a substring of a longer string), the argument is printed until its terminating null. In the case that the argument wasn't null terminated, but depended on the length, jio_print would wander off through memory finding things to print until it came to a null byte, seg-faulted, or whatever.

              Assignee:
              Peter Kessler
              Reporter:
              Peter Kessler
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: