[Lldb-commits] [PATCH] Fix FileSpec::GetPath to return null-terminated strings
Ilia K
ki.stfu at gmail.com
Thu Feb 26 23:31:33 PST 2015
@clayborg, see my comments below.
================
Comment at: source/Host/common/SocketAddress.cpp:51
@@ -50,4 +50,3 @@
{
- strncpy(dst, formatted, size);
- return dst;
+ return ::strcpy(dst, formatted);
}
----------------
clayborg wrote:
> Why did you switch to using an unsafe strcpy() here? You can overflow "dst" no?
It can't overflow because we in "if (formatted && strlen(formatted) < size)" branch.
================
Comment at: source/Host/common/SocketAddress.cpp:66
@@ -66,4 +65,3 @@
{
- strncpy(dst,tmp,size);
- return dst;
+ return ::strcpy(dst, tmp);
}
----------------
clayborg wrote:
> Why did you switch to using an unsafe strcpy() here? You can overflow "dst" no?
the same reason.
================
Comment at: source/lldb.cpp:373
@@ -372,3 +372,3 @@
- ::strncpy(g_version_string, version_string, version_len);
+ ::snprintf(g_version_string, version_len + 1, "%s", version_string);
}
----------------
clayborg wrote:
> This should be:
>
>
> ```
> ::snprintf(g_version_string, sizeof(g_version_string), "%s", version_string);
>
> ```
no. we can't do that because it returns a string until first '\n'.
http://reviews.llvm.org/D7553
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the lldb-commits
mailing list