ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Convert-BER-XS/XS.xs
(Generate patch)

Comparing Convert-BER-XS/XS.xs (file contents):
Revision 1.18 by root, Sat Apr 20 16:12:53 2019 UTC vs.
Revision 1.19 by root, Sat Apr 20 16:34:34 2019 UTC

263 if (!(c & 0x80)) 263 if (!(c & 0x80))
264 return res; 264 return res;
265 } 265 }
266} 266}
267 267
268// get_w, but disallow padding
269static UV
270get_w_nopad (void)
271{
272 U8 first = get_u8 ();
273
274 if (first == 0x80)
275 error ("illegal BER padding");
276
277 --cur;
278
279 return get_w ();
280}
281
268static UV 282static UV
269get_length (void) 283get_length (void)
270{ 284{
271 UV res = get_u8 (); 285 UV res = get_u8 ();
272 286
378 error ("OBJECT IDENTIFIER length equal to zero"); 392 error ("OBJECT IDENTIFIER length equal to zero");
379 return &PL_sv_undef; 393 return &PL_sv_undef;
380 } 394 }
381 395
382 U8 *end = cur + len; 396 U8 *end = cur + len;
383 UV w = get_w (); 397 UV w = get_w_nopad ();
384 398
385 static char oid[MAX_OID_STRLEN]; // static, becaueds too large for stack 399 static char oid[MAX_OID_STRLEN]; // static, becaueds too large for stack
386 char *app = oid; 400 char *app = oid;
387 401
388 if (relative) 402 if (relative)
404 { 418 {
405 // we assume an oid component is never > 64 digits 419 // we assume an oid component is never > 64 digits
406 if (oid + sizeof (oid) - app < 64) 420 if (oid + sizeof (oid) - app < 64)
407 croak ("BER_TYPE_OID to long to decode"); 421 croak ("BER_TYPE_OID to long to decode");
408 422
409 w = get_w (); 423 w = get_w_nopad ();
410 *app++ = '.'; 424 *app++ = '.';
411 app = write_uv (app, w); 425 app = write_uv (app, w);
412 } 426 }
413 427
414 return newSVpvn (oid, app - oid); 428 return newSVpvn (oid, app - oid);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines