Skip to content
  • Philip Withnall's avatar
    stun: Explicitly avoid a memcpy() from NULL · 869093b3
    Philip Withnall authored and Olivier Crête's avatar Olivier Crête committed
    If stun_message_append_bytes() is called through
    stun_message_append_flag(), data will be NULL and len will be 0. This
    will result in a memcpy(ptr, NULL, 0) call. This probably won’t do any
    harm (since any reasonable memcpy() implementation will immediately
    return if (len == 0)), but the standard allows for memcpy() to explode
    if (data == NULL), regardless of the value of len.
    
    In order to be conformant, and to shut up the scan-build static analysis
    warning about it, only do the memcpy() if (len > 0).
    869093b3