Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
e74487cd
Unverified
Commit
e74487cd
authored
Dec 05, 2023
by
Mouse
Committed by
GitHub
Dec 05, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #150 from v0-e/jer-utf8-fix
jer: OCTET STRING UTF-8 add quotes
parents
f766a858
aa2eb978
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
5 deletions
+32
-5
skeletons/BMPString_jer.c
skeletons/BMPString_jer.c
+9
-2
skeletons/OCTET_STRING_jer.c
skeletons/OCTET_STRING_jer.c
+23
-3
No files found.
skeletons/BMPString_jer.c
View file @
e74487cd
...
...
@@ -79,6 +79,7 @@ BMPString_encode_jer(const asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
const
BMPString_t
*
st
=
(
const
BMPString_t
*
)
sptr
;
asn_enc_rval_t
er
=
{
0
,
0
,
0
};
ssize_t
ro_encoded
=
0
;
(
void
)
ilevel
;
(
void
)
flags
;
...
...
@@ -86,8 +87,14 @@ BMPString_encode_jer(const asn_TYPE_descriptor_t *td, const void *sptr,
if
(
!
st
||
!
st
->
buf
)
ASN__ENCODE_FAILED
;
er
.
encoded
=
BMPString__dump
(
st
,
cb
,
app_key
);
if
(
er
.
encoded
<
0
)
ASN__ENCODE_FAILED
;
ASN__CALLBACK
(
"
\"
"
,
1
);
ro_encoded
=
BMPString__dump
(
st
,
cb
,
app_key
);
if
(
ro_encoded
<
0
)
goto
cb_failed
;
er
.
encoded
+=
ro_encoded
;
ASN__CALLBACK
(
"
\"
"
,
1
);
ASN__ENCODED_OK
(
er
);
cb_failed:
ASN__ENCODE_FAILED
;
}
skeletons/OCTET_STRING_jer.c
View file @
e74487cd
...
...
@@ -160,6 +160,7 @@ OCTET_STRING_encode_jer_utf8(const asn_TYPE_descriptor_t *td, const void *sptr,
buf
=
st
->
buf
;
end
=
buf
+
st
->
size
;
ASN__CALLBACK
(
"
\"
"
,
1
);
for
(
ss
=
buf
;
buf
<
end
;
buf
++
)
{
unsigned
int
ch
=
*
buf
;
int
s_len
;
/* Special encoding sequence length */
...
...
@@ -180,10 +181,15 @@ OCTET_STRING_encode_jer_utf8(const asn_TYPE_descriptor_t *td, const void *sptr,
encoded_len
+=
(
buf
-
ss
);
if
((
buf
-
ss
)
&&
cb
(
ss
,
buf
-
ss
,
app_key
)
<
0
)
ASN__ENCODE_FAILED
;
goto
cb_failed
;
er
.
encoded
+=
encoded_len
;
er
.
encoded
=
encoded_len
;
ASN__CALLBACK
(
"
\"
"
,
1
)
;
ASN__ENCODED_OK
(
er
);
cb_failed:
ASN__ENCODE_FAILED
;
}
#define CQUOTE 0x22
...
...
@@ -333,8 +339,22 @@ OCTET_STRING__convert_entrefs(void *sptr, const void *chunk_buf,
const
char
*
pend
=
p
+
chunk_size
;
uint8_t
*
buf
;
/* Strip quotes */
for
(;
p
<
pend
;
++
p
)
{
if
(
*
p
==
CQUOTE
)
{
++
p
;
break
;
}
}
for
(;
pend
>=
p
;
--
pend
)
{
if
(
*
pend
==
CQUOTE
)
break
;
}
if
(
pend
-
p
<
0
)
return
-
1
;
/* Reallocate buffer */
size_t
new_size
=
st
->
size
+
chunk_size
;
size_t
new_size
=
st
->
size
+
(
pend
-
p
)
;
void
*
nptr
=
REALLOC
(
st
->
buf
,
new_size
+
1
);
if
(
!
nptr
)
return
-
1
;
st
->
buf
=
(
uint8_t
*
)
nptr
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment