You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2017/02/23 22:51:24 UTC

[17/38] qpid-proton git commit: PROTON-1360: Make sure pn_strndup doesn't overrun allocated memory

PROTON-1360: Make sure pn_strndup doesn't overrun allocated memory


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/7560f58e
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/7560f58e
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/7560f58e

Branch: refs/heads/go1
Commit: 7560f58ea708f971799442ac657d8e73a5b97e34
Parents: 39c70d1
Author: Andrew Stitcher <as...@apache.org>
Authored: Tue Feb 14 18:16:10 2017 -0500
Committer: Andrew Stitcher <as...@apache.org>
Committed: Wed Feb 15 13:37:03 2017 -0500

----------------------------------------------------------------------
 proton-c/src/core/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/7560f58e/proton-c/src/core/util.c
----------------------------------------------------------------------
diff --git a/proton-c/src/core/util.c b/proton-c/src/core/util.c
index 62eec9a..4309de3 100644
--- a/proton-c/src/core/util.c
+++ b/proton-c/src/core/util.c
@@ -147,7 +147,7 @@ char *pn_strndup(const char *src, size_t n)
 
     char *dest = (char *) malloc(size + 1);
     if (!dest) return NULL;
-    strncpy(dest, src, n);
+    strncpy(dest, src, pn_min(n, size));
     dest[size] = '\0';
     return dest;
   } else {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org