844209c CryptoPkg/Crt: turn strchr() into a function (CVE-2019-14553)

Authored and Committed by lersek 4 years ago
    CryptoPkg/Crt: turn strchr() into a function (CVE-2019-14553)
    
    According to the ISO C standard, strchr() is a function. We #define it as
    a macro. Unfortunately, our macro evaluates the first argument ("str")
    twice. If the expression passed for "str" has side effects, the behavior
    may be undefined.
    
    In a later patch in this series, we're going to resurrect "inet_pton.c"
    (originally from the StdLib package), which calls strchr() just like that:
    
      strchr((xdigits = xdigits_l), ch)
      strchr((xdigits = xdigits_u), ch)
    
    To enable this kind of function call, turn strchr() into a function.
    
    Cc: David Woodhouse <dwmw2@infradead.org>
    Cc: Jian J Wang <jian.j.wang@intel.com>
    Cc: Jiaxin Wu <jiaxin.wu@intel.com>
    Cc: Sivaraman Nainar <sivaramann@amiindia.co.in>
    Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
    Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=960
    CVE: CVE-2019-14553
    Signed-off-by: Laszlo Ersek <lersek@redhat.com>