[gimp] fix bogus use of g_strlcpy
- From: Simon Budig <simon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] fix bogus use of g_strlcpy
- Date: Fri, 15 Aug 2014 23:01:07 +0000 (UTC)
commit e0e29889b0dc76ebdd5322a2e8e195da3128f5a7
Author: Simon Budig <simon budig de>
Date: Fri Aug 15 23:08:42 2014 +0200
fix bogus use of g_strlcpy
Spotted by Andrey Karpov using static code analysis:
http://www.viva64.com/en/b/0273/
app/core/gimpbrushgenerated-load.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/app/core/gimpbrushgenerated-load.c b/app/core/gimpbrushgenerated-load.c
index 70ed152..71172dd 100644
--- a/app/core/gimpbrushgenerated-load.c
+++ b/app/core/gimpbrushgenerated-load.c
@@ -116,11 +116,15 @@ gimp_brush_generated_load (GimpContext *context,
/* the empty string is not an allowed name */
if (strlen (string) < 1)
- g_strlcpy (string, _("Untitled"), sizeof (string));
-
- name = gimp_any_to_utf8 (string, -1,
- _("Invalid UTF-8 string in brush file '%s'."),
- gimp_file_get_utf8_name (file));
+ {
+ name = g_strdup (_("Untitled"));
+ }
+ else
+ {
+ name = gimp_any_to_utf8 (string, -1,
+ _("Invalid UTF-8 string in brush file '%s'."),
+ gimp_file_get_utf8_name (file));
+ }
g_free (string);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]