git.samba.org
/
abartlet
/
lorikeet-heimdal.git
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d4fc674
)
Windows: Don't attempt to copy a string to a zero length buffer
author
Asanka Herath
<asanka@secure-endpoints.com>
Tue, 24 Aug 2010 04:04:51 +0000
(
00:04
-0400)
committer
Asanka C. Herath
<asanka@secure-endpoints.com>
Tue, 14 Sep 2010 12:03:33 +0000
(08:03 -0400)
It won't cause harm since strcpy_s() deals with zero length buffers,
but it invokes the invalid parameter handler, which can disrupt
execution on debug builds.
lib/roken/strlcpy.c
patch
|
blob
|
history
diff --git
a/lib/roken/strlcpy.c
b/lib/roken/strlcpy.c
index 7c1789bd1f95b15053c5a16c1e0d9ba177cb24e9..0fe2b97fccb22e0dc83770ac08f6a0849fb5afae 100644
(file)
--- a/
lib/roken/strlcpy.c
+++ b/
lib/roken/strlcpy.c
@@
-43,7
+43,8
@@
strlcpy (char *dst, const char *src, size_t dst_cch)
{
errno_t e;
- e = strcpy_s(dst, dst_cch, src);
+ if (dst_cch > 0)
+ e = strncpy_s(dst, dst_cch, src, _TRUNCATE);
return strlen (src);
}