aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2013-12-22 18:00:45 +1100
committerNeil <nyamatongwe@gmail.com>2013-12-22 18:00:45 +1100
commitdac5800933977672e8d2d67854a97a517abbe47d (patch)
treec057a54cf4b5f01be58cc5042ee30043a2363ba6 /cocoa
parent3f4549e26cb8182fa236ea3c8a08c20a71e4da38 (diff)
downloadscintilla-mirror-dac5800933977672e8d2d67854a97a517abbe47d.tar.gz
Avoid unsafe strcpy, strncpy, and strcat replacing with safer functions which
guaranty termination where possible.
Diffstat (limited to 'cocoa')
-rw-r--r--cocoa/PlatCocoa.mm6
1 files changed, 2 insertions, 4 deletions
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm
index 3d3417b82..5567088d1 100644
--- a/cocoa/PlatCocoa.mm
+++ b/cocoa/PlatCocoa.mm
@@ -1839,8 +1839,7 @@ void ListBoxImpl::GetValue(int n, char* value, int len)
value[0] = '\0';
return;
}
- strncpy(value, textString, len);
- value[len - 1] = '\0';
+ strlcpy(value, textString, len);
}
void ListBoxImpl::RegisterImage(int type, const char* xpm_data)
@@ -2217,8 +2216,7 @@ bool Platform::ShowAssertionPopUps(bool assertionPopUps_)
void Platform::Assert(const char *c, const char *file, int line)
{
char buffer[2000];
- sprintf(buffer, "Assertion [%s] failed at %s %d", c, file, line);
- strcat(buffer, "\r\n");
+ snprintf(buffer, sizeof(buffer), "Assertion [%s] failed at %s %d\r\n", c, file, line);
Platform::DebugDisplay(buffer);
#ifdef DEBUG
// Jump into debugger in assert on Mac (CL269835)