Allow hex-strings to be separated by space characters:

opensc-tool -s "00 A4 00 00 02 3F 00 00"

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5187 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
andre 2011-02-06 22:43:12 +00:00
parent 1008062844
commit c209e3a757
1 changed files with 2 additions and 2 deletions

View File

@ -56,7 +56,7 @@ int sc_hex_to_bin(const char *in, u8 *out, size_t *outlen)
while (*in != '\0') {
int byte = 0, nybbles = 2;
while (nybbles-- && *in && *in != ':') {
while (nybbles-- && *in && *in != ':' && *in != ' ') {
char c;
byte <<= 4;
c = *in++;
@ -74,7 +74,7 @@ int sc_hex_to_bin(const char *in, u8 *out, size_t *outlen)
}
byte |= c;
}
if (*in == ':')
if (*in == ':' || *in == ' ')
in++;
if (left <= 0) {
err = SC_ERROR_BUFFER_TOO_SMALL;