This add a static inline version of `g_memdup2` if the version of glib we're
compiling against doesn't have the function.
GHSL-2021-045 was originally reported to glib at
https://gitlab.gnome.org/GNOME/glib/-/issues/2319.
More information about the entire situation can be found on the gnome
desktop-devel-list at
https://mail.gnome.org/archives/desktop-devel-list/2021-February/msg00000.html
Testing Done:
Compiled and ran tests locally.
Reviewed at https://reviews.imfreedom.org/r/483/
/*
* Purple's oscar protocol plugin
* This file is the legal property of its developers.
* Please see the AUTHORS file distributed alongside this file.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
/*
* Family 0x0004 - Routines for sending/receiving Instant Messages.
*
* Note the term ICBM (Inter-Client Basic Message) which blankets
* all types of generically routed through-server messages. Within
* the ICBM types (family 4), a channel is defined. Each channel
* represents a different type of message. Channel 1 is used for
* what would commonly be called an "instant message". Channel 2
* is used for negotiating "rendezvous". These transactions end in
* something more complex happening, such as a chat invitation, or
* a file transfer. Channel 3 is used for chat messages (not in
* the same family as these channels). Channel 4 is used for
* various ICQ messages. Examples are normal messages, URLs, and
* old-style authorization.
*
* In addition to the channel, every ICBM contains a cookie. For
* standard IMs, these are only used for error messages. However,
* the more complex rendezvous messages make suitably more complex
* use of this field.
*
* TODO: Split this up into an im.c file an an icbm.c file. It
* will be beautiful, you'll see.
*
* Make sure flap_connection_findbygroup is used by all functions.
*/
#include"encoding.h"
#include"oscar.h"
#include"peer.h"
#ifdef _WIN32
#include"win32dep.h"
#endif
#include"util.h"
staticconstchar*consterrcodereason[]={
N_("Invalid error"),
N_("Not logged in"),
N_("Cannot receive IM due to parental controls"),
N_("Cannot send SMS without accepting terms"),
N_("Cannot send SMS"),/* SMS_WITHOUT_DISCLAIMER is weird */
* This used to be done using tlvchains. For performance reasons,
* I've changed it to process the TLVs in-place. This avoids lots
* of per-IM memory allocations.
*/
while(byte_stream_bytes_left(bs)>=4)
{
type=byte_stream_get16(bs);
length=byte_stream_get16(bs);
if(length>byte_stream_bytes_left(bs))
{
purple_debug_misc("oscar","Received an IM containing an invalid message part from %s. They are probably trying to do something malicious.\n",userinfo->bn);