4 | | - Modify the spec of pjlib-util's scanner. Originally, the spec said that the scanner will add the NULL terminator right AFTER the end of the buffer, however it turns out that the current implementation didn't do that, probably for a good reason, i.e. to avoid buffer overwrite. So, we change the spec instead, to require that the input buffer passed to the scanner needs to be NULL terminated by app. |
| 4 | - Modify the spec of pjlib-util's scanner. Originally, the spec said that the scanner will add the NULL terminator right AFTER the end of the buffer, however it turns out that the current implementation doesn't do that, probably for a few good reasons, i.e. to avoid buffer overwrite, prevent writing to a read-only buffer, and avoid synchronization issue (when more than one thread process the same buffer) . So, we change the spec instead, to require that the input buffer passed to the scanner to be NULL terminated by app. |
| 5 | - There are a few instances in the library where we don't pass NULL terminated buffer to the scanner. This is intentional and should be safe because: |
| 6 | * The buffer should be part of a bigger, NULL-terminated buffer (for example, when parsing each line in the SDP). |
| 7 | * We can take advantage of another character as the sentinel (such as newline). |