13.04.2013 Views

KB_110097 - Vasco

KB_110097 - Vasco

KB_110097 - Vasco

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>KB</strong> <strong>110097</strong><br />

Null termination problem of aat_ascii buffers in C/C++<br />

implementations of the VACMAN Controller.<br />

Creation date: 30/09/2011 Last Review: 06/02/2012 Revision number: 2<br />

Document type: Documentation Security status: EXTERNAL<br />

Summary<br />

Based on the VACMAN Controller Programmer’s Guide all the aat_ascii string buffers<br />

must be null terminated and all aat_ascii string buffers returned by the VACMAN<br />

Controller will be null-terminated. But the sw_out_type output parameter returned by<br />

a VACMAN Controller function is not null terminated.<br />

Details<br />

The VACMAN Controller Programmer’s Guide clearly states that aat_ascii String Buffers<br />

must be null terminated:<br />

3.1.3 Null-Termination of aat_ascii String Buffers<br />

To be handled correctly, all the aat_ascii string buffers passed in the<br />

parameters of a function must be null-terminated. This null character \0 allows the<br />

VACMAN Controller to determine the aat_ascii string length.<br />

CAUTION<br />

aat_ascii string buffers which are not null-terminated may cause<br />

your system to crash.<br />

In addition, all the aat_ascii string buffers filled and returned by a function will<br />

be null-terminated.<br />

aat_byte buffers passed in the parameters of a function must not be nullterminated.<br />

However the sw_out_type parameter of type aat_ascii, generated by the<br />

AAL2DPXGetToken function is not null terminated.<br />

The sw_out_type of the VACMAN Controller returns a fixed length of 5 digits and the<br />

correct implementation would be to pass in at least a buffer sw_out_type of 6<br />

characters (5+1)<br />

Applies to: VACMAN Controller<br />

<strong>KB</strong> <strong>110097</strong> – 6/02/2012 16:05<br />

© 2012 VASCO Data Security. All rights reserved.<br />

Page 1 of 2


Since the length of sw_out_type is always a fixed length of 5 digits, in earlier versions<br />

of the VACMAN Controller the null terminator was not required.<br />

Changing this behavior now and forcing the sixth character to be a null character could<br />

cause issues in upgrade scenarios from older versions to recent versions of the<br />

VACMAN Controller.<br />

A workaround can be to pass in a sw_out_type buffer of 6 chars which has been<br />

initialized to 0 before the function call:<br />

memset (sw_out_type, 0, 6);<br />

Applies to: VACMAN Controller<br />

<strong>KB</strong> <strong>110097</strong> – 6/02/2012 16:05<br />

© 2012 VASCO Data Security. All rights reserved.<br />

Page 2 of 2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!