diff options
author | Neil <nyamatongwe@gmail.com> | 2013-12-22 18:00:45 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2013-12-22 18:00:45 +1100 |
commit | ca1a5ea845c283a9c84fd2ae9f6d152cca354183 (patch) | |
tree | d851b7c06cc7763849d504b58797199c9032b441 /cocoa | |
parent | 0b56a6704d1c64644d5bfef318806f8490d649ec (diff) | |
download | scintilla-mirror-ca1a5ea845c283a9c84fd2ae9f6d152cca354183.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.mm | 6 |
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) |