Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-02-13 06:21:27 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-02-13 06:21:27 +0300
commit867fc4b463ef39ea16103f18f332c3d259624d29 (patch)
tree7d20c416241afb7b878b767a9955e284d3cddbe2 /source/blender/blenkernel/intern/font.c
parent9e03a0d4762b4734fe7ccb20e03b4a3c8f939620 (diff)
enforce string limits (reported by pedantic checking tools & some developers).
mostly replace strcpy with BLI_strncpy and multiple strcat's with a BLI_snprintf(). also fix possible crash if CWD isnt available.
Diffstat (limited to 'source/blender/blenkernel/intern/font.c')
-rw-r--r--source/blender/blenkernel/intern/font.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 1d7ce197cba..9de8af2c981 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -96,13 +96,14 @@ chtoutf8(unsigned long c, char *o)
void
wcs2utf8s(char *dst, wchar_t *src)
{
- char ch[5];
+ /* NULL terminator not needed */
+ char ch[4];
while(*src)
{
- memset(ch, 0, 5);
+ memset(ch, 0, sizeof(ch));
chtoutf8(*src++, ch);
- strcat(dst, ch);
+ dst= strncat(dst, ch, sizeof(ch));
}
}
@@ -363,14 +364,14 @@ VFont *load_vfont(const char *name)
struct TmpFont *tmpfnt;
if (strcmp(name, FO_BUILTIN_NAME)==0) {
- strcpy(filename, name);
+ BLI_strncpy(filename, name, sizeof(filename));
pf= get_builtin_packedfile();
is_builtin= 1;
} else {
char dir[FILE_MAXDIR];
- strcpy(dir, name);
+ BLI_strncpy(dir, name, sizeof(dir));
BLI_splitdirstring(dir, filename);
pf= newPackedFile(NULL, name);