@@ -62,18 +62,18 @@ static inline bool inplace(std::string &value) {
6262                    }
6363                    j++; /*  j is the position of the first digit now. */ 
6464
65-                     constexpr  int  MAX_HEX_DIGITS = 2 ;   //  supports only bytes (max value 0xff)
6665                    auto  k = j;
67-                     while  ((j - k < MAX_HEX_DIGITS) && (j  < input_len) && (isxdigit (input[j]))) {
66+                     while  ((j < input_len) && (isxdigit (input[j]))) {
6867                        j++;
6968                    }
7069                    if  (j > k) { /*  Do we have at least one digit? */ 
7170                        /*  Decode the entity. */ 
72-                         char  x[MAX_HEX_DIGITS  + 1 ];
73-                         memcpy (x, ( const   char  *)&input[k], j - k );
71+                         char  *x =  new   char [(j - k)  + 1 ];
72+                         std::copy (input + k, input + j, x );
7473                        x[j - k] = ' \0 '  ;
7574
7675                        *d++ = (unsigned  char )strtol (x, nullptr , 16 );
76+                         delete[]  x;
7777
7878                        /*  Skip over the semicolon if it's there. */ 
7979                        if  ((j < input_len) && (input[j] == ' ;'  )) {
@@ -87,18 +87,19 @@ static inline bool inplace(std::string &value) {
8787                    }
8888                } else  {
8989                    /*  Decimal entity. */ 
90-                     constexpr  int  MAX_DEC_DIGITS = 3 ;   //  supports only bytes (max value 255)
9190                    auto  k = j;
92-                     while  ((j - k < MAX_DEC_DIGITS) && (j < input_len) && (isdigit (input[j]))) {
91+ 
92+                     while  ((j < input_len) && (isdigit (input[j]))) {
9393                        j++;
9494                    }
9595                    if  (j > k) { /*  Do we have at least one digit? */ 
9696                        /*  Decode the entity. */ 
97-                         char  x[MAX_DEC_DIGITS + 1 ];
98-                         memcpy (x, (const  char  *)&input[k], j - k);
99-                         x[j - k] = ' \0 '  ;
97+                         char  *x = new  char [j - k + 1 ];
98+                         std::copy (input + k, input + j, x);
10099
100+                         x[j - k] = ' \0 '  ;
101101                        *d++ = (unsigned  char )strtol (x, nullptr , 10 );
102+                         delete[]  x;
102103
103104                        /*  Skip over the semicolon if it's there. */ 
104105                        if  ((j < input_len) && (input[j] == ' ;'  )) {
0 commit comments