#357 Segmentation faults when logging in using smartcard

Future
open
Internals (36)
5
2012-07-28
2012-07-24
rkron
No

I can succesfully connect to a Windows TS using rdesktpp 1.7.1.
But when smartcard must be used to login, rdesktop crashes after having entered the PIN code, reporting a segmentation fault.

This can be fixed easily in the next version of rdesktop by adding a condition test in the body of the SC_xfreeallmemory function in the scard.c file.
the xfree call must be conditional, test that the datasize of the handle is not zero. This will do, rdesktop remains stable after that.

setup is tested with rdesktop package 1.7.1 downloaded from rdesktop.org, pcsc-litepackage 1.5.2-7, smartcard driver ccid package 1.3.9, and glibc package 1.12-1.80, on a laptop running 64 bits RHEL 6

Discussion

  • rkron
    rkron
    2012-07-26

    bugfixed code

     
    Attachments
  • rkron
    rkron
    2012-07-26

    Upoloaded the file containing the bugfix (line 424).
    rdesktop session remained stable the whole working day.

     
    • assigned_to: nobody --> hean01
     
  • Hi Rob,

    I just reviewed your fix and it looks wrong, memory will never be freed
    due to the condition will always evaluated as false because of the previous
    memset() which zeroes out the memory area.

    I can't reproduce the fail so it would be nice if you can revert and provide a
    backtrace for your crash.

     
  • rkron
    rkron
    2012-07-29

    screenshot of smartcard login prompt

     
  • rkron
    rkron
    2012-07-29

    configure command options and logging

     
  • rkron
    rkron
    2012-07-29

    make output

     
  • rkron
    rkron
    2012-07-29

    Hi Henrik,

    As requested, a smartcard debug trace file is attached. A ascreenshot of the smatrcard login dialog is also present. Hopefully this will do for you?
    After entering the PIN the segmentation fault occors and the RDP session is terminated.

    Of course a proper memory management is important, but at the moment I would not worry about memory not being freed properly, the rdesktop program is being used on a Lenovo Thinkpad T420 with 8Gb memory installed.

    Fyi, the segmentation fault also occurs when using rdesktop 1.6.0.