forked from osmocom/wireshark
C12.22: check c1222_baseoid_len before doing a memcpy
Should fix the following runtime error reported by Joerg: ../../asn1/c1222/packet-c1222-template.c:1427:3: runtime error: null pointer passed as argument 1, which is declared to never be null ../../asn1/c1222/packet-c1222-template.c:1427:3: runtime error: null pointer passed as argument 2, which is declared to never be null Change-Id: I2f952815ed81e47b504e6479835a357b7656828e Reviewed-on: https://code.wireshark.org/review/8251 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jörg Mayer <jmayer@loplof.de> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
This commit is contained in:
parent
b849726351
commit
aa3870f54d
|
@ -1422,10 +1422,16 @@ proto_reg_handoff_c1222(void)
|
|||
dissector_add_uint("udp.port", global_c1222_port, c1222_udp_handle);
|
||||
initialized = TRUE;
|
||||
}
|
||||
c1222_baseoid_len = oid_string2encoded(NULL, c1222_baseoid_str, &temp);
|
||||
c1222_baseoid = (guint8 *)wmem_realloc(wmem_epan_scope(), c1222_baseoid, c1222_baseoid_len);
|
||||
memcpy(c1222_baseoid, temp, c1222_baseoid_len);
|
||||
wmem_free(NULL, temp);
|
||||
if (c1222_baseoid_str && (c1222_baseoid_str[0] != '\0') &&
|
||||
((c1222_baseoid_len = oid_string2encoded(NULL, c1222_baseoid_str, &temp)) != 0)) {
|
||||
c1222_baseoid = (guint8 *)wmem_realloc(wmem_epan_scope(), c1222_baseoid, c1222_baseoid_len);
|
||||
memcpy(c1222_baseoid, temp, c1222_baseoid_len);
|
||||
wmem_free(NULL, temp);
|
||||
} else if (c1222_baseoid) {
|
||||
wmem_free(wmem_epan_scope(), c1222_baseoid);
|
||||
c1222_baseoid = NULL;
|
||||
c1222_baseoid_len = 0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
|
|
|
@ -2062,10 +2062,16 @@ proto_reg_handoff_c1222(void)
|
|||
dissector_add_uint("udp.port", global_c1222_port, c1222_udp_handle);
|
||||
initialized = TRUE;
|
||||
}
|
||||
c1222_baseoid_len = oid_string2encoded(NULL, c1222_baseoid_str, &temp);
|
||||
c1222_baseoid = (guint8 *)wmem_realloc(wmem_epan_scope(), c1222_baseoid, c1222_baseoid_len);
|
||||
memcpy(c1222_baseoid, temp, c1222_baseoid_len);
|
||||
wmem_free(NULL, temp);
|
||||
if (c1222_baseoid_str && (c1222_baseoid_str[0] != '\0') &&
|
||||
((c1222_baseoid_len = oid_string2encoded(NULL, c1222_baseoid_str, &temp)) != 0)) {
|
||||
c1222_baseoid = (guint8 *)wmem_realloc(wmem_epan_scope(), c1222_baseoid, c1222_baseoid_len);
|
||||
memcpy(c1222_baseoid, temp, c1222_baseoid_len);
|
||||
wmem_free(NULL, temp);
|
||||
} else if (c1222_baseoid) {
|
||||
wmem_free(wmem_epan_scope(), c1222_baseoid);
|
||||
c1222_baseoid = NULL;
|
||||
c1222_baseoid_len = 0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
||||
|
|
Loading…
Reference in New Issue