Skip to content
  • Jehan's avatar
    plug-ins: metadata-editor crashes when strtok() initialized with NULL. · 62ee5d3c
    Jehan authored
    When running strtok() the first time, it needs to be non-NULL so we must
    check for the string. This is even more important because NULL actually
    has a special meaning in strtok() to indicate further search on the same
    string, in a stateful way. So searching with NULL at first call was
    crashing the metadata editor plug-in in my case.
    I could also imagine it could have reused strings from previous
    searches, mixing metadata contents in some edge cases. Anyway that would
    be bad as well!
    
    While I was there, I also checked for non-null search string before
    strstr() calls, when there was not already such a check before. This
    function also requires non-NULL haystack argument.
    It feels like this code doesn't do much validity checks, and it's likely
    there are more similar issues. I haven't reviewed the whole code, only
    this part which was crashing here.
    62ee5d3c