aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Luyer <andre@luyer.nl>2019-12-27 17:45:06 +0100
committerPascal Quantin <pascal@wireshark.org>2020-01-11 18:36:35 +0000
commitdbfb204f487097032d83de318c26cacd185a9d4e (patch)
treeae59f35a9d744598a67915b2bf20a59acbc28064
parent3f17a8948fbbe7b6e2767ae9c53e503706952a70 (diff)
ber: display x509af.utcTime year in 4 digits
Because: - the 2-digit year can only be in the range 1950..2049 according to https://tools.ietf.org/html/rfc5280#section-4.1.2.5.1 - to avoid confusion, interpreting the year/month/day in a different order may still represent a valid date. - now both utcTime and GeneralizedTime are displayed in exactly the same way. - some tools, like Perl, apply a different date range when converting 2-digit years. In packet-ber.c two parameters are added to the function dissect_ber_UTCTime: datestrptr: if not NULL return datetime string instead of adding to tree or NULL when packet is malformed tvblen: if not NULL return consumed packet bytes Also the memory allocation for outstr is now done using the recommended method as described in the README.developer document. The calling function in x509af/x509sat uses this to prepend the century. Added generated files. Change-Id: I714c2e8e7f899211caaa1f4136ca0d27cb1aba4a Reviewed-on: https://code.wireshark.org/review/35414 Petri-Dish: Pascal Quantin <pascal@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Reviewed-by: Pascal Quantin <pascal@wireshark.org>
-rw-r--r--epan/dissectors/asn1/x509af/x509af.cnf11
-rw-r--r--epan/dissectors/asn1/x509sat/x509sat.cnf11
-rw-r--r--epan/dissectors/packet-HI2Operations.c2
-rw-r--r--epan/dissectors/packet-acp133.c2
-rw-r--r--epan/dissectors/packet-ber.c26
-rw-r--r--epan/dissectors/packet-ber.h3
-rw-r--r--epan/dissectors/packet-cms.c2
-rw-r--r--epan/dissectors/packet-dap.c2
-rw-r--r--epan/dissectors/packet-dop.c2
-rw-r--r--epan/dissectors/packet-dsp.c2
-rw-r--r--epan/dissectors/packet-p1.c4
-rw-r--r--epan/dissectors/packet-p22.c2
-rw-r--r--epan/dissectors/packet-p7.c8
-rw-r--r--epan/dissectors/packet-p772.c2
-rw-r--r--epan/dissectors/packet-pkix1explicit.c2
-rw-r--r--epan/dissectors/packet-rtse.c2
-rw-r--r--epan/dissectors/packet-x509af.c21
-rw-r--r--epan/dissectors/packet-x509sat.c15
-rwxr-xr-xtools/asn2wrs.py2
19 files changed, 88 insertions, 33 deletions
diff --git a/epan/dissectors/asn1/x509af/x509af.cnf b/epan/dissectors/asn1/x509af/x509af.cnf
index ef077bd1ca..1b77328522 100644
--- a/epan/dissectors/asn1/x509af/x509af.cnf
+++ b/epan/dissectors/asn1/x509af/x509af.cnf
@@ -145,6 +145,17 @@ CertificateList/signedCertificateList/revokedCertificates/_item/userCertificate
offset = dissect_ber_length(actx->pinfo, tree, tvb, offset, &len, &ind);
offset=call_ber_oid_callback(actx->external.direct_reference, tvb, offset, actx->pinfo, tree, NULL);
+#.FN_BODY Time/utcTime
+ char *outstr, *newstr;
+ guint32 tvblen;
+
+ /* the 2-digit year can only be in the range 1950..2049 https://tools.ietf.org/html/rfc5280#section-4.1.2.5.1 */
+ offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index, &outstr, &tvblen);
+ if (hf_index >= 0 && outstr) {
+ newstr = wmem_strconcat(wmem_packet_scope(), outstr[0] < '5' ? "20": "19", outstr, NULL);
+ proto_tree_add_string(tree, hf_index, tvb, offset - tvblen, tvblen, newstr);
+ }
+
#.FN_BODY SubjectName
const char* str;
diff --git a/epan/dissectors/asn1/x509sat/x509sat.cnf b/epan/dissectors/asn1/x509sat/x509sat.cnf
index 23471e6cf8..e37b6aff2a 100644
--- a/epan/dissectors/asn1/x509sat/x509sat.cnf
+++ b/epan/dissectors/asn1/x509sat/x509sat.cnf
@@ -374,6 +374,17 @@ XDayOf/fifth fifth_dayof
#.END
+#.FN_BODY Time/utcTime
+ char *outstr, *newstr;
+ guint32 tvblen;
+
+ /* the 2-digit year can only be in the range 1950..2049 https://tools.ietf.org/html/rfc5280#section-4.1.2.5.1 */
+ offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index, &outstr, &tvblen);
+ if (hf_index >= 0 && outstr) {
+ newstr = wmem_strconcat(wmem_packet_scope(), outstr[0] < '5' ? "20": "19", outstr, NULL);
+ proto_tree_add_string(tree, hf_index, tvb, offset - tvblen, tvblen, newstr);
+ }
+
#.FN_BODY GUID
gint8 ber_class;
gboolean pc;
diff --git a/epan/dissectors/packet-HI2Operations.c b/epan/dissectors/packet-HI2Operations.c
index a4a888ff87..d722a266a4 100644
--- a/epan/dissectors/packet-HI2Operations.c
+++ b/epan/dissectors/packet-HI2Operations.c
@@ -768,7 +768,7 @@ dissect_HI2Operations_LocalTimeStamp(gboolean implicit_tag _U_, tvbuff_t *tvb _U
static int
dissect_HI2Operations_UTCTime(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index);
+ offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index, NULL, NULL);
return offset;
}
diff --git a/epan/dissectors/packet-acp133.c b/epan/dissectors/packet-acp133.c
index 3804f97b89..6b23161437 100644
--- a/epan/dissectors/packet-acp133.c
+++ b/epan/dissectors/packet-acp133.c
@@ -422,7 +422,7 @@ dissect_acp133_INTEGER(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
dissect_acp133_UTCTime(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index);
+ offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index, NULL, NULL);
return offset;
}
diff --git a/epan/dissectors/packet-ber.c b/epan/dissectors/packet-ber.c
index 8cd173ba56..a0858f96eb 100644
--- a/epan/dissectors/packet-ber.c
+++ b/epan/dissectors/packet-ber.c
@@ -3780,12 +3780,13 @@ invalid:
return end_offset;
}
-
+/* datestrptr: if not NULL return datetime string instead of adding to tree or NULL when packet is malformed
+ * tvblen: if not NULL return consumed packet bytes
+ */
int
-dissect_ber_UTCTime(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id)
+dissect_ber_UTCTime(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id, char **datestrptr, guint32 *tvblen)
{
- char outstr[33];
- char *outstrptr = outstr;
+ char *outstr, *outstrptr;
const guint8 *instr;
gint8 ber_class;
gboolean pc;
@@ -3798,6 +3799,11 @@ dissect_ber_UTCTime(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *tree, t
proto_tree *error_tree;
const gchar *error_str = NULL;
+ outstrptr = outstr = (char *)wmem_alloc(wmem_packet_scope(), 29);
+
+ if (datestrptr) *datestrptr = NULL; /* mark invalid */
+ if (tvblen) *tvblen = 0;
+
if (!implicit_tag) {
hoffset = offset;
identifier_offset = offset;
@@ -3908,9 +3914,14 @@ dissect_ber_UTCTime(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *tree, t
goto malformed;
}
- if (hf_id >= 0) {
- proto_tree_add_string(tree, hf_id, tvb, offset, len, outstr);
+ if (datestrptr) {
+ *datestrptr = outstr; /* mark as valid */
+ } else {
+ if (hf_id >= 0) {
+ proto_tree_add_string(tree, hf_id, tvb, offset, len, outstr);
+ }
}
+ if (tvblen) *tvblen = len;
return offset+len;
malformed:
@@ -3927,10 +3938,11 @@ malformed:
"%s",
error_str);
+ if (tvblen) *tvblen = len;
+
return offset+len;
}
-
/* 8.6 Encoding of a bitstring value */
int
diff --git a/epan/dissectors/packet-ber.h b/epan/dissectors/packet-ber.h
index ba88dd3ac7..07bd09f2c9 100644
--- a/epan/dissectors/packet-ber.h
+++ b/epan/dissectors/packet-ber.h
@@ -167,8 +167,7 @@ WS_DLL_PUBLIC int dissect_ber_set_of(gboolean implicit_tag, asn1_ctx_t *actx, pr
WS_DLL_PUBLIC int dissect_ber_GeneralizedTime(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id);
-WS_DLL_PUBLIC int dissect_ber_UTCTime(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id);
-
+WS_DLL_PUBLIC int dissect_ber_UTCTime(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int offset, gint hf_id, char **datestrptr, guint32 *tvblen);
extern int dissect_ber_constrained_bitstring(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *parent_tree, tvbuff_t *tvb, int offset, gint32 min_len, gint32 max_len, const int **named_bits, int num_named_bits, gint hf_id, gint ett_id, tvbuff_t **out_tvb);
WS_DLL_PUBLIC int dissect_ber_bitstring(gboolean implicit_tag, asn1_ctx_t *actx, proto_tree *parent_tree, tvbuff_t *tvb, int offset, const int **named_bits, gint num_named_bits, gint hf_id, gint ett_id, tvbuff_t **out_tvb);
diff --git a/epan/dissectors/packet-cms.c b/epan/dissectors/packet-cms.c
index c735cb366c..a8702955be 100644
--- a/epan/dissectors/packet-cms.c
+++ b/epan/dissectors/packet-cms.c
@@ -1580,7 +1580,7 @@ dissect_cms_MessageDigest(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs
static int
dissect_cms_UTCTime(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index);
+ offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index, NULL, NULL);
return offset;
}
diff --git a/epan/dissectors/packet-dap.c b/epan/dissectors/packet-dap.c
index 2decf1bc70..bd5d440111 100644
--- a/epan/dissectors/packet-dap.c
+++ b/epan/dissectors/packet-dap.c
@@ -1599,7 +1599,7 @@ dissect_dap_PagedResultsRequest(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in
static int
dissect_dap_UTCTime(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index);
+ offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index, NULL, NULL);
return offset;
}
diff --git a/epan/dissectors/packet-dop.c b/epan/dissectors/packet-dop.c
index d9b5e8beaf..1bf0e2522b 100644
--- a/epan/dissectors/packet-dop.c
+++ b/epan/dissectors/packet-dop.c
@@ -663,7 +663,7 @@ dissect_dop_NULL(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, a
static int
dissect_dop_UTCTime(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index);
+ offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index, NULL, NULL);
return offset;
}
diff --git a/epan/dissectors/packet-dsp.c b/epan/dissectors/packet-dsp.c
index a0b79521b7..564050e544 100644
--- a/epan/dissectors/packet-dsp.c
+++ b/epan/dissectors/packet-dsp.c
@@ -422,7 +422,7 @@ dissect_dsp_DomainInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
dissect_dsp_UTCTime(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index);
+ offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index, NULL, NULL);
return offset;
}
diff --git a/epan/dissectors/packet-p1.c b/epan/dissectors/packet-p1.c
index 1d5033c146..1bdb0d5659 100644
--- a/epan/dissectors/packet-p1.c
+++ b/epan/dissectors/packet-p1.c
@@ -1168,7 +1168,7 @@ dissect_p1_Signature(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U
static int
dissect_p1_UTCTime(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index);
+ offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index, NULL, NULL);
return offset;
}
@@ -2771,7 +2771,7 @@ dissect_p1_Time(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, as
tvbuff_t *arrival = NULL;
p1_address_ctx_t* ctx = (p1_address_ctx_t*)actx->subtree.tree_ctx;
- offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index);
+ offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index, NULL, NULL);
if(arrival && ctx && ctx->do_address)
diff --git a/epan/dissectors/packet-p22.c b/epan/dissectors/packet-p22.c
index 1b5beb10d7..a939742aee 100644
--- a/epan/dissectors/packet-p22.c
+++ b/epan/dissectors/packet-p22.c
@@ -866,7 +866,7 @@ static int dissect_p22_ForwardedContentToken(gboolean implicit_tag _U_, tvbuff_t
static int
dissect_p22_Time(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index);
+ offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index, NULL, NULL);
return offset;
}
diff --git a/epan/dissectors/packet-p7.c b/epan/dissectors/packet-p7.c
index 2ecc25acba..b28c53bc3f 100644
--- a/epan/dissectors/packet-p7.c
+++ b/epan/dissectors/packet-p7.c
@@ -1343,7 +1343,7 @@ dissect_p7_NumberRange(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset
static int
dissect_p7_CreationTime(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index);
+ offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index, NULL, NULL);
return offset;
}
@@ -3501,7 +3501,7 @@ dissect_p7_ReportSummary(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
static int
dissect_p7_DeferredDeliveryCancellationTime(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index);
+ offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index, NULL, NULL);
return offset;
}
@@ -3510,7 +3510,7 @@ dissect_p7_DeferredDeliveryCancellationTime(gboolean implicit_tag _U_, tvbuff_t
static int
dissect_p7_DeletionTime(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index);
+ offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index, NULL, NULL);
return offset;
}
@@ -3613,7 +3613,7 @@ dissect_p7_StoragePeriod(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offse
static int
dissect_p7_StorageTime(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index);
+ offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index, NULL, NULL);
return offset;
}
diff --git a/epan/dissectors/packet-p772.c b/epan/dissectors/packet-p772.c
index 8fcf99fdfb..43ffb2f4e9 100644
--- a/epan/dissectors/packet-p772.c
+++ b/epan/dissectors/packet-p772.c
@@ -440,7 +440,7 @@ dissect_p772_ExemptedAddressSeq(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, in
static int
dissect_p772_ExtendedAuthorisationInfo(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index);
+ offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index, NULL, NULL);
return offset;
}
diff --git a/epan/dissectors/packet-pkix1explicit.c b/epan/dissectors/packet-pkix1explicit.c
index b4deafc2d3..e0d1ae519b 100644
--- a/epan/dissectors/packet-pkix1explicit.c
+++ b/epan/dissectors/packet-pkix1explicit.c
@@ -218,7 +218,7 @@ dissect_pkix1explicit_CertificateSerialNumber(gboolean implicit_tag _U_, tvbuff_
static int
dissect_pkix1explicit_UTCTime(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index);
+ offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index, NULL, NULL);
return offset;
}
diff --git a/epan/dissectors/packet-rtse.c b/epan/dissectors/packet-rtse.c
index 6ee6bab690..8b05a04017 100644
--- a/epan/dissectors/packet-rtse.c
+++ b/epan/dissectors/packet-rtse.c
@@ -352,7 +352,7 @@ static int
dissect_rtse_CommonReference(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
#line 128 "./asn1/rtse/rtse.cnf"
tvbuff_t *string = NULL;
- offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index);
+ offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index, NULL, NULL);
if(open_request && string)
col_append_fstr(actx->pinfo->cinfo, COL_INFO, " %s", tvb_format_text(string, 0, tvb_reported_length(string)));
diff --git a/epan/dissectors/packet-x509af.c b/epan/dissectors/packet-x509af.c
index e9674fa9d4..e39c89ea3b 100644
--- a/epan/dissectors/packet-x509af.c
+++ b/epan/dissectors/packet-x509af.c
@@ -74,7 +74,7 @@ static int hf_x509af_notBefore = -1; /* Time */
static int hf_x509af_notAfter = -1; /* Time */
static int hf_x509af_algorithm = -1; /* AlgorithmIdentifier */
static int hf_x509af_subjectPublicKey = -1; /* T_subjectPublicKey */
-static int hf_x509af_utcTime = -1; /* UTCTime */
+static int hf_x509af_utcTime = -1; /* T_utcTime */
static int hf_x509af_generalizedTime = -1; /* GeneralizedTime */
static int hf_x509af_Extensions_item = -1; /* Extension */
static int hf_x509af_extnId = -1; /* T_extnId */
@@ -259,8 +259,19 @@ dissect_x509af_AlgorithmIdentifier(gboolean implicit_tag _U_, tvbuff_t *tvb _U_,
static int
-dissect_x509af_UTCTime(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index);
+dissect_x509af_T_utcTime(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
+#line 149 "./asn1/x509af/x509af.cnf"
+ char *outstr, *newstr;
+ guint32 tvblen;
+
+ /* the 2-digit year can only be in the range 1950..2049 https://tools.ietf.org/html/rfc5280#section-4.1.2.5.1 */
+ offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index, &outstr, &tvblen);
+ if (hf_index >= 0 && outstr) {
+ newstr = wmem_strconcat(wmem_packet_scope(), outstr[0] < '5' ? "20": "19", outstr, NULL);
+ proto_tree_add_string(tree, hf_index, tvb, offset - tvblen, tvblen, newstr);
+ }
+
+
return offset;
}
@@ -282,7 +293,7 @@ const value_string x509af_Time_vals[] = {
};
static const ber_choice_t Time_choice[] = {
- { 0, &hf_x509af_utcTime , BER_CLASS_UNI, BER_UNI_TAG_UTCTime, BER_FLAGS_NOOWNTAG, dissect_x509af_UTCTime },
+ { 0, &hf_x509af_utcTime , BER_CLASS_UNI, BER_UNI_TAG_UTCTime, BER_FLAGS_NOOWNTAG, dissect_x509af_T_utcTime },
{ 1, &hf_x509af_generalizedTime, BER_CLASS_UNI, BER_UNI_TAG_GeneralizedTime, BER_FLAGS_NOOWNTAG, dissect_x509af_GeneralizedTime },
{ 0, NULL, 0, 0, 0, NULL }
};
@@ -324,7 +335,7 @@ static const ber_choice_t SubjectName_choice[] = {
static int
dissect_x509af_SubjectName(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 149 "./asn1/x509af/x509af.cnf"
+#line 160 "./asn1/x509af/x509af.cnf"
const char* str;
offset = dissect_ber_choice(actx, tree, tvb, offset,
diff --git a/epan/dissectors/packet-x509sat.c b/epan/dissectors/packet-x509sat.c
index e3099efb3b..5a1dbdf30f 100644
--- a/epan/dissectors/packet-x509sat.c
+++ b/epan/dissectors/packet-x509sat.c
@@ -1450,7 +1450,18 @@ dissect_x509sat_SyntaxGeneralizedTime(gboolean implicit_tag _U_, tvbuff_t *tvb _
static int
dissect_x509sat_SyntaxUTCTime(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index);
+#line 378 "./asn1/x509sat/x509sat.cnf"
+ char *outstr, *newstr;
+ guint32 tvblen;
+
+ /* the 2-digit year can only be in the range 1950..2049 https://tools.ietf.org/html/rfc5280#section-4.1.2.5.1 */
+ offset = dissect_ber_UTCTime(implicit_tag, actx, tree, tvb, offset, hf_index, &outstr, &tvblen);
+ if (hf_index >= 0 && outstr) {
+ newstr = wmem_strconcat(wmem_packet_scope(), outstr[0] < '5' ? "20": "19", outstr, NULL);
+ proto_tree_add_string(tree, hf_index, tvb, offset - tvblen, tvblen, newstr);
+ }
+
+
return offset;
}
@@ -1602,7 +1613,7 @@ dissect_x509sat_SyntaxGeneralString(gboolean implicit_tag _U_, tvbuff_t *tvb _U_
static int
dissect_x509sat_GUID(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
-#line 378 "./asn1/x509sat/x509sat.cnf"
+#line 389 "./asn1/x509sat/x509sat.cnf"
gint8 ber_class;
gboolean pc;
gint32 tag;
diff --git a/tools/asn2wrs.py b/tools/asn2wrs.py
index dc6e0a953f..408a5795f5 100755
--- a/tools/asn2wrs.py
+++ b/tools/asn2wrs.py
@@ -5246,7 +5246,7 @@ class UTCTime (RestrictedCharacterStringType):
def eth_type_default_body(self, ectx, tname):
if (ectx.Ber()):
body = ectx.eth_fn_call('dissect_%(ER)s_%(STRING_TYPE)s', ret='offset',
- par=(('%(IMPLICIT_TAG)s', '%(ACTX)s', '%(TREE)s', '%(TVB)s', '%(OFFSET)s', '%(HF_INDEX)s'),))
+ par=(('%(IMPLICIT_TAG)s', '%(ACTX)s', '%(TREE)s', '%(TVB)s', '%(OFFSET)s', '%(HF_INDEX)s', 'NULL', 'NULL'),))
return body
else:
return RestrictedCharacterStringType.eth_type_default_body(self, ectx, tname)