mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
ghostutils: Add a missing precondition check to g_hostname_to_unicode()
This helps out scan-build, which otherwise thinks there could be a `NULL` pointer dereference. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Helps: #1767
This commit is contained in:
parent
057f0fcbfb
commit
cf940496df
@ -32,6 +32,7 @@
|
||||
|
||||
#include "garray.h"
|
||||
#include "gmem.h"
|
||||
#include "gmessages.h"
|
||||
#include "gstring.h"
|
||||
#include "gstrfuncs.h"
|
||||
#include "glibintl.h"
|
||||
@ -667,6 +668,8 @@ g_hostname_to_unicode (const gchar *hostname)
|
||||
gssize llen;
|
||||
gsize hostname_max_length_bytes = get_hostname_max_length_bytes ();
|
||||
|
||||
g_return_val_if_fail (hostname != NULL, NULL);
|
||||
|
||||
/* See the comment at the top of g_hostname_to_ascii(). */
|
||||
if (hostname_max_length_bytes <= G_MAXSIZE / 4 &&
|
||||
strlen_greater_than (hostname, 4 * MAX (255, hostname_max_length_bytes)))
|
||||
|
Loading…
Reference in New Issue
Block a user