patch-2.1.111 linux/net/ax25/ax25_addr.c

Next file: linux/net/ax25/ax25_out.c
Previous file: linux/net/ax25/af_ax25.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.110/linux/net/ax25/ax25_addr.c linux/net/ax25/ax25_addr.c
@@ -165,19 +165,23 @@
 
 	if (len < 14) return NULL;
 
-	*flags = 0;
-
-	if (buf[6] & AX25_CBIT)
-		*flags = AX25_COMMAND;
-	if (buf[13] & AX25_CBIT)
-		*flags = AX25_RESPONSE;
+	if (flags != NULL) {
+		*flags = 0;
+		
+		if (buf[6] & AX25_CBIT)
+			*flags = AX25_COMMAND;
+		if (buf[13] & AX25_CBIT)
+			*flags = AX25_RESPONSE;
+	}
 
 	if (dama != NULL) 
 		*dama = ~buf[13] & AX25_DAMA_FLAG;
 
 	/* Copy to, from */
-	memcpy(dest, buf + 0, AX25_ADDR_LEN);
-	memcpy(src,  buf + 7, AX25_ADDR_LEN);
+	if (dest != NULL)
+		memcpy(dest, buf + 0, AX25_ADDR_LEN);
+	if (src != NULL)
+		memcpy(src,  buf + 7, AX25_ADDR_LEN);
 
 	buf += 2 * AX25_ADDR_LEN;
 	len -= 2 * AX25_ADDR_LEN;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov