libmapper: fix logic bug

sarraylen returns the number of strings and does not include the
trailing null pointer.  This results in sarraydup creating arrays of
strings where the array is not null pointer terminated (the strings
themselves _are_ \0 terminated), which in turn causes random data to be
passed to free.

The bug was found using static analysis and inspection would indicate
exposure only exists on error and shutdown paths, which might be a hint
as to how this has been lurking for as long as it has.

Change-Id: Ie5e5b6cdfb7832c84037ff039b41082fc7d20b61
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
7 files changed
tree: 65fa85c661c9f714e2e46d277ec4c5085947effd
  1. fail-monitor/
  2. libmapper/
  3. src/
  4. .clang-format
  5. .gitignore
  6. bootstrap.sh
  7. configure.ac
  8. LICENSE
  9. MAINTAINERS
  10. Makefile.am
  11. README.md
README.md

To Build

To build this package, do the following steps:

    1. ./bootstrap.sh
    2. ./configure ${CONFIGURE_FLAGS}
    3. make

To clean the repository run `./bootstrap.sh clean`.