From 3cdd54092cdc91acaa02a61bdce0a975c853071c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=96=87=E5=93=B2?= Date: Tue, 26 Dec 2017 23:31:19 +0800 Subject: [PATCH] Fix BERcodec_STRING --- scapy/asn1/ber.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scapy/asn1/ber.py b/scapy/asn1/ber.py index c2b0cf3a5..deadf770f 100644 --- a/scapy/asn1/ber.py +++ b/scapy/asn1/ber.py @@ -337,7 +337,8 @@ class BERcodec_STRING(BERcodec_Object): tag = ASN1_Class_UNIVERSAL.STRING @classmethod def enc(cls,s): - return chb(hash(cls.tag))+BER_len_enc(len(s))+raw(s) # Be sure we are encoding bytes + s = raw(s) + return chb(hash(cls.tag))+BER_len_enc(len(s))+s # Be sure we are encoding bytes @classmethod def do_dec(cls, s, context=None, safe=False): l,s,t = cls.check_type_check_len(s)