mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-26 22:16:16 +01:00
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:
parent
25d950b61f
commit
7414dc2cb3
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user