You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2015/01/09 15:57:51 UTC

[1/3] trafficserver git commit: Use memcpy() instead of strncpy() on non-NULL terminated strings. This is safer and faster, and avoids a Coverity error.

Repository: trafficserver
Updated Branches:
  refs/heads/master b1c542a50 -> 11537217c


Use memcpy() instead of strncpy() on non-NULL terminated strings.
This is safer and faster, and avoids a Coverity error.

Coverity CID #1254810


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/a1a30aa4
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/a1a30aa4
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/a1a30aa4

Branch: refs/heads/master
Commit: a1a30aa47e3c5c790042f034cbfe71fbdaadcfab
Parents: b1c542a
Author: Leif Hedstrom <zw...@apache.org>
Authored: Fri Jan 9 07:28:30 2015 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Fri Jan 9 07:28:30 2015 -0700

----------------------------------------------------------------------
 proxy/http2/HTTP2.cc | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/a1a30aa4/proxy/http2/HTTP2.cc
----------------------------------------------------------------------
diff --git a/proxy/http2/HTTP2.cc b/proxy/http2/HTTP2.cc
index c1c181d..e1d2ab3 100644
--- a/proxy/http2/HTTP2.cc
+++ b/proxy/http2/HTTP2.cc
@@ -305,10 +305,11 @@ convert_from_2_to_1_1_header(HTTPHdr* headers)
     size_t url_length = scheme_len + 3 + authority_len + path_len;
     char* url = arena.str_alloc(url_length);
     const char* url_start = url;
-    strncpy(url, scheme, scheme_len);
-    strncpy(url+scheme_len, "://", 3);
-    strncpy(url+scheme_len+3, authority, authority_len);
-    strncpy(url+scheme_len+3+authority_len, path, path_len);
+
+    memcpy(url, scheme, scheme_len);
+    memcpy(url+scheme_len, "://", 3);
+    memcpy(url+scheme_len+3, authority, authority_len);
+    memcpy(url+scheme_len+3+authority_len, path, path_len);
     url_parse(headers->m_heap, headers->m_http->u.req.m_url_impl, &url_start, url + url_length, 1);
     arena.str_free(url);
 


[2/3] trafficserver git commit: TS-3284 Remove ink_strncpy() and ink_strlcpy()

Posted by zw...@apache.org.
TS-3284 Remove ink_strncpy() and ink_strlcpy()


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/fc4bce1e
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/fc4bce1e
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/fc4bce1e

Branch: refs/heads/master
Commit: fc4bce1e9aad461b82f54ef33399c5a465551221
Parents: a1a30aa
Author: Leif Hedstrom <zw...@apache.org>
Authored: Fri Jan 9 07:42:54 2015 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Fri Jan 9 07:42:54 2015 -0700

----------------------------------------------------------------------
 lib/ts/ink_string.cc | 48 -----------------------------------------------
 lib/ts/ink_string.h  |  2 --
 2 files changed, 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fc4bce1e/lib/ts/ink_string.cc
----------------------------------------------------------------------
diff --git a/lib/ts/ink_string.cc b/lib/ts/ink_string.cc
index 3307381..c079b5e 100644
--- a/lib/ts/ink_string.cc
+++ b/lib/ts/ink_string.cc
@@ -43,54 +43,6 @@ ink_memcpy_until_char(char *dst, char *src, unsigned int n, unsigned char c)
 
 /*---------------------------------------------------------------------------*
 
-  char *ink_strncpy(char *dest, char *src, int n)
-
-  This routine is a safer version of strncpy which always NUL terminates
-  the destination string.  Note that this routine has the SAME semantics
-  as strncpy, such as copying exactly n bytes, padding dest with NULs
-  is necessary.  Use ink_string_copy for a non-padding version.
-
- *---------------------------------------------------------------------------*/
-
-char *
-ink_strncpy(char *dest, const char *src, int n)
-{
-  if (likely(src && dest)) {
-    if (n > 1)
-      strncpy(dest, src, (n - 1));
-    if (n > 0)
-      dest[n - 1] = '\0';
-  }
-
-  return (dest);
-}                               /* End ink_strncpy */
-
-/*---------------------------------------------------------------------------*
-
-  char *ink_strncat(char *dest, char *src, int n)
-
-  This routine is a safer version of strncat which always NUL terminates
-  the destination string.  Note that this routine has the SAME semantics
-  as strncat, such as concatinating exactly n bytes, padding dest with NULs
-  is necessary.  Use ink_string_copy for a non-padding version.
-
- *---------------------------------------------------------------------------*/
-
-char *
-ink_strncat(char *dest, const char *src, int n)
-{
-  if (likely(src && dest)) {
-    if (n > 1)
-      strncat(dest, src, (n - 1));
-    if (n > 0)
-      dest[n - 1] = '\0';
-  }
-
-  return (dest);
-}                               /* End ink_strncat */
-
-/*---------------------------------------------------------------------------*
-
   char *ink_string_concatenate_strings(char *dest, ...)
 
   This routine concatenates a variable number of strings into the buffer

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/fc4bce1e/lib/ts/ink_string.h
----------------------------------------------------------------------
diff --git a/lib/ts/ink_string.h b/lib/ts/ink_string.h
index 7048ada..a822cc5 100644
--- a/lib/ts/ink_string.h
+++ b/lib/ts/ink_string.h
@@ -50,8 +50,6 @@
 /* these are supposed to be fast */
 
 inkcoreapi char *ink_memcpy_until_char(char *dst, char *src, unsigned int n, unsigned char c);
-inkcoreapi char *ink_strncpy(char *dest, const char *src, int n);
-inkcoreapi char *ink_strncat(char *dest, const char *src, int n);
 inkcoreapi char *ink_string_concatenate_strings(char *dest, ...);
 inkcoreapi char *ink_string_concatenate_strings_n(char *dest, int n, ...);
 inkcoreapi char *ink_string_append(char *dest, char *src, int n);


[3/3] trafficserver git commit: Added TS-3284

Posted by zw...@apache.org.
Added TS-3284


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/11537217
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/11537217
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/11537217

Branch: refs/heads/master
Commit: 11537217ce3aa56ce4af2989e0e01acf2713928e
Parents: fc4bce1
Author: Leif Hedstrom <zw...@apache.org>
Authored: Fri Jan 9 07:43:12 2015 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Fri Jan 9 07:43:12 2015 -0700

----------------------------------------------------------------------
 CHANGES | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/11537217/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 35a7cbe..66f019d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.3.0
 
+  *) [TS-3284] Remove ink_strncpy() and ink_strlcpy().
+
   *) [TS-3219] Create WCCP client process.
 
   *) [TS-3272] Fix to ensure that SSL_SNI callback only called when state