Clarify memset in set_tz_name

* glib/gtimezone.c (set_tz_name): Use size, not NAME_SIZE,
to clear the buffer.  Suggested by Philip Withnall in:
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1533#note_867859
This commit is contained in:
Paul Eggert 2020-07-16 12:41:49 -07:00
parent 25d950b61f
commit 7414dc2cb3

View File

@ -1465,7 +1465,7 @@ set_tz_name (gchar **pos, gchar *buffer, guint size)
if (*pos - name_pos < 3)
return FALSE;
memset (buffer, 0, NAME_SIZE);
memset (buffer, 0, size);
/* name_pos isn't 0-terminated, so we have to limit the length expressly */
len = *pos - name_pos > size - 1 ? size - 1 : *pos - name_pos;
strncpy (buffer, name_pos, len);