Compare secrets file contents with strncmp() rather than memcmp()
Compare secrets file contents with strncmp() rather than memcmp()

The strncmp() stops at null, but memcmp() goes on that can lead to buffer
overflows.  Notice that memchr() in read_file_contents() ensures there are
no stray nulls in the file, and that the file buffer is null terminated, so
use of strncmp() should be safe.

Issue was noticed when copiled with address sanitizer, and run test suite,
that reported:

FAIL: tests/pam_google_authenticator_unittest
=============================================

=================================================================
==20659==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60300000032d at pc 0x55ea44e5dfcf bp 0x7ffef77f66d0 sp 0x7ffef77f5e80
READ of size 12 at 0x60300000032d thread T0
    #0 0x55ea44e5dfce in __interceptor_memcmp.part.282 (/home/src/google-authenticator-libpam/tests/pam_google_authenticator_unittest+0xb7fce)
    #1 0x7fb2ec4f2270 in get_cfg_value /home/src/google-authenticator-libpam/src/pam_google_authenticator.c:673:46
    #2 0x7fb2ec4ed828 in get_hotp_counter /home/src/google-authenticator-libpam/src/pam_google_authenticator.c:821:29
    #3 0x7fb2ec4e6d22 in google_authenticator /home/src/google-authenticator-libpam/src/pam_google_authenticator.c:1647:29
    #4 0x7fb2ec4e5fe8 in pam_sm_authenticate /home/src/google-authenticator-libpam/src/pam_google_authenticator.c:1902:10
    #5 0x55ea44ebeb20 in main /home/src/google-authenticator-libpam/tests/pam_google_authenticator_unittest.c:343:5
    #6 0x7fb2ef19ff69 in __libc_start_main (/usr/lib/libc.so.6+0x20f69)
    #7 0x55ea44dc4549 in _start (/home/src/google-authenticator-libpam/tests/pam_google_authenticator_unittest+0x1e549)

0x60300000032d is located 0 bytes to the right of 29-byte region [0x603000000310,0x60300000032d)
allocated by thread T0 here:
    #0 0x55ea44e842c1 in malloc (/home/src/google-authenticator-libpam/tests/pam_google_authenticator_unittest+0xde2c1)
    #1 0x7fb2ec4ebdfb in read_file_contents /home/src/google-authenticator-libpam/src/pam_google_authenticator.c:462:15
    #2 0x7fb2ec4e6bb4 in google_authenticator /home/src/google-authenticator-libpam/src/pam_google_authenticator.c:1635:13
    #3 0x7fb2ec4e5fe8 in pam_sm_authenticate /home/src/google-authenticator-libpam/src/pam_google_authenticator.c:1902:10
    #4 0x55ea44ebeb20 in main /home/src/google-authenticator-libpam/tests/pam_google_authenticator_unittest.c:343:5
    #5 0x7fb2ef19ff69 in __libc_start_main (/usr/lib/libc.so.6+0x20f69)

SUMMARY: AddressSanitizer: heap-buffer-overflow (/home/src/google-authenticator-libpam/tests/pam_google_authenticator_unittest+0xb7fce) in __interceptor_memcmp.part.282
Shadow bytes around the buggy address:
  0x0c067fff8010: 07 fa fa fa 00 00 00 02 fa fa 00 00 06 fa fa fa
  0x0c067fff8020: 00 00 00 01 fa fa 00 00 00 02 fa fa 00 00 00 01
  0x0c067fff8030: fa fa 00 00 07 fa fa fa 00 00 04 fa fa fa 00 00
  0x0c067fff8040: 00 01 fa fa 00 00 00 fa fa fa 00 00 00 fa fa fa
  0x0c067fff8050: 00 00 00 03 fa fa 00 00 00 03 fa fa 00 00 00 fa
=>0x0c067fff8060: fa fa 00 00 00[05]fa fa 00 00 01 fa fa fa fa fa
  0x0c067fff8070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c067fff8080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c067fff8090: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c067fff80a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c067fff80b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==20659==ABORTING
FAIL tests/pam_google_authenticator_unittest (exit status: 1)

google/google-authenticator-libpam,google/google-authenticator-libpam,google/google-authenticator-libpam,google/google-authenticator-libpam