[gimp] plug-ins: remove use of strcpy without length checking in metadata-editor.
- From: Jacob Boerema <jboerema src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: remove use of strcpy without length checking in metadata-editor.
- Date: Tue, 16 Mar 2021 17:17:13 +0000 (UTC)
commit 87763cbe275bb0a2a13cf2774f298db98ac27b1e
Author: Jacob Boerema <jgboerema gmail com>
Date: Thu Mar 11 18:01:04 2021 -0500
plug-ins: remove use of strcpy without length checking in metadata-editor.
plug-ins/metadata/metadata-editor.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/plug-ins/metadata/metadata-editor.c b/plug-ins/metadata/metadata-editor.c
index 8400db32e5..14590691f9 100644
--- a/plug-ins/metadata/metadata-editor.c
+++ b/plug-ins/metadata/metadata-editor.c
@@ -3210,29 +3210,31 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
for (item = 0; item < counter; item++)
{
gchar **tagdatarow = (gchar **) tagdata[item];
- gchar type1[256];
- gchar type2[256];
+ gchar *type1;
+ gchar *type2;
gint types;
- strcpy (type1, gettext (phone_types[0].display));
- strcpy (type2, gettext (phone_types[0].display));
+ type1 = g_strdup (gettext (phone_types[0].display));
+ type2 = g_strdup (gettext (phone_types[0].display));
for (types = 0; types < 6; types++)
{
+ /* phone type 1 */
if (tagdatarow[3] &&
! strcmp (tagdatarow[3],
phone_types[types].data))
{
- strcpy (type1,
- gettext (phone_types[types].display));
+ g_free (type1);
+ type1 = g_strdup (gettext (phone_types[types].display));
}
+ /* phone type 2 */
if (tagdatarow[5] &&
! strcmp (tagdatarow[5],
phone_types[types].data))
{
- strcpy (type2,
- gettext (phone_types[types].display));
+ g_free (type2);
+ type2 = g_strdup (gettext (phone_types[types].display));
}
}
@@ -3241,12 +3243,14 @@ metadata_dialog_editor_set_metadata (GExiv2Metadata *metadata,
COL_LICENSOR_NAME, tagdatarow[0],
COL_LICENSOR_ID, tagdatarow[1],
COL_LICENSOR_PHONE1, tagdatarow[2],
- COL_LICENSOR_PHONE_TYPE1, (gchar*)&type1,
+ COL_LICENSOR_PHONE_TYPE1, type1,
COL_LICENSOR_PHONE2, tagdatarow[4],
- COL_LICENSOR_PHONE_TYPE2, (gchar*)&type2,
+ COL_LICENSOR_PHONE_TYPE2, type2,
COL_LICENSOR_EMAIL, tagdatarow[6],
COL_LICENSOR_WEB, tagdatarow[7],
-1);
+ g_free (type1);
+ g_free (type2);
}
free_tagdata(tagdata, counter, n_licensor);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]