Bug 1458048 - Cherry pick usersctp rev 8789a6da02e2c7c03522bc6f275b302f6ef977fe; r=drno, a=RyanVM FENNEC_61_0_BUILD2 FENNEC_61_0_RELEASE FIREFOX_61_0_BUILD3 FIREFOX_61_0_RELEASE
authorDaniel Minor <dminor@mozilla.com>
Wed, 20 Jun 2018 21:18:50 -0400
changeset 473783 785d242a5b01d5f1094882aa2144d8e5e2791e06
parent 473782 61ce1b424ccca62c4269c46006d115f2aeb082bc
child 473784 59666a63d70019113d2e07fde2add4adcb274ce4
push id1732
push userjcristau@mozilla.com
push dateThu, 21 Jun 2018 12:56:25 +0000
treeherdermozilla-release@785d242a5b01 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdrno, RyanVM
bugs1458048
milestone61.0
Bug 1458048 - Cherry pick usersctp rev 8789a6da02e2c7c03522bc6f275b302f6ef977fe; r=drno, a=RyanVM
netwerk/sctp/src/netinet/sctp_auth.c
netwerk/sctp/src/netinet/sctp_pcb.c
--- a/netwerk/sctp/src/netinet/sctp_auth.c
+++ b/netwerk/sctp/src/netinet/sctp_auth.c
@@ -29,17 +29,17 @@
  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifdef __FreeBSD__
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/netinet/sctp_auth.c 324971 2017-10-25 09:12:22Z tuexen $");
+__FBSDID("$FreeBSD: head/sys/netinet/sctp_auth.c 334532 2018-06-02 16:28:10Z tuexen $");
 #endif
 
 #include <netinet/sctp_os.h>
 #include <netinet/sctp.h>
 #include <netinet/sctp_header.h>
 #include <netinet/sctp_pcb.h>
 #include <netinet/sctp_var.h>
 #include <netinet/sctp_sysctl.h>
@@ -1525,16 +1525,18 @@ sctp_auth_get_cookie_params(struct sctp_
 		keylen += sizeof(*chunks) + num_chunks;
 	}
 	new_key = sctp_alloc_key(keylen);
 	if (new_key != NULL) {
 	    /* copy in the RANDOM */
 	    if (p_random != NULL) {
 		keylen = sizeof(*p_random) + random_len;
 		memcpy(new_key->key, p_random, keylen);
+	    } else {
+		keylen = 0;
 	    }
 	    /* append in the AUTH chunks */
 	    if (chunks != NULL) {
 		memcpy(new_key->key + keylen, chunks,
 		       sizeof(*chunks) + num_chunks);
 		keylen += sizeof(*chunks) + num_chunks;
 	    }
 	    /* append in the HMACs */
--- a/netwerk/sctp/src/netinet/sctp_pcb.c
+++ b/netwerk/sctp/src/netinet/sctp_pcb.c
@@ -29,17 +29,17 @@
  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifdef __FreeBSD__
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/netinet/sctp_pcb.c 325370 2017-11-03 20:46:12Z tuexen $");
+__FBSDID("$FreeBSD: head/sys/netinet/sctp_pcb.c 334532 2018-06-02 16:28:10Z tuexen $");
 #endif
 
 #include <netinet/sctp_os.h>
 #ifdef __FreeBSD__
 #include <sys/proc.h>
 #endif
 #include <netinet/sctp_var.h>
 #include <netinet/sctp_sysctl.h>
@@ -7742,16 +7742,18 @@ sctp_load_addresses_from_init(struct sct
 		keylen += sizeof(*chunks) + num_chunks;
 	}
 	new_key = sctp_alloc_key(keylen);
 	if (new_key != NULL) {
 		/* copy in the RANDOM */
 		if (p_random != NULL) {
 			keylen = sizeof(*p_random) + random_len;
 			memcpy(new_key->key, p_random, keylen);
+		} else {
+			keylen = 0;
 		}
 		/* append in the AUTH chunks */
 		if (chunks != NULL) {
 			memcpy(new_key->key + keylen, chunks,
 			       sizeof(*chunks) + num_chunks);
 			keylen += sizeof(*chunks) + num_chunks;
 		}
 		/* append in the HMACs */