diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-07-23 16:49:30 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-07-23 16:49:30 +0400 |
commit | 3ff3d1bc0fa6979d0745dbd7526cbb5c35c1fcbf (patch) | |
tree | 99df5ec67111abede3cb2e29b469bb7a1ff2b3ae /source/blender/blenkernel | |
parent | a5bc02194345de1eb21f843b73ce24799677aea1 (diff) |
replace use of strcat() where the string offset is known.
also correct bad logic with converting a textblock to 3d-text, bytes-vs-number of chars wasn't handled right.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/property.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/text.c | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c index ec23a7db8a1..73f2a864e32 100644 --- a/source/blender/blenkernel/intern/property.c +++ b/source/blender/blenkernel/intern/property.c @@ -177,9 +177,9 @@ void BKE_bproperty_unique(bProperty *first, bProperty *prop, int force) i = 0; do { /* ensure we have enough chars for the new number in the name */ - BLI_snprintf(num, sizeof(num), "%d", i++); - BLI_strncpy(new_name, base_name, sizeof(prop->name) - strlen(num)); - strcat(new_name, num); + const size_t num_len = BLI_snprintf(num, sizeof(num), "%d", i++); + BLI_snprintf(new_name, sizeof(prop->name), + "%.*s%s", (int)(sizeof(prop->name) - num_len), base_name, num); } while (bproperty_get(first, prop, new_name)); BLI_strncpy(prop->name, new_name, sizeof(prop->name)); diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 8d63be5fbd5..0daa9de3ae2 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -2359,7 +2359,7 @@ static void txt_delete_line(Text *text, TextLine *line) static void txt_combine_lines(Text *text, TextLine *linea, TextLine *lineb) { - char *tmp; + char *tmp, *s; if (!text) return; @@ -2368,8 +2368,10 @@ static void txt_combine_lines(Text *text, TextLine *linea, TextLine *lineb) tmp = MEM_mallocN(linea->len + lineb->len + 1, "textline_string"); - strcpy(tmp, linea->line); - strcat(tmp, lineb->line); + s = tmp; + s += BLI_strcpy_rlen(s, linea->line); + s += BLI_strcpy_rlen(s, lineb->line); + (void)s; make_new_line(linea, tmp); |