]> Cypherpunks repositories - gostls13.git/commit
internal/syscall/windows/registry: fix read overrun in GetStringsValue
authorPatrick Mezard <patrick@mezard.eu>
Sat, 9 May 2015 13:51:45 +0000 (15:51 +0200)
committerAlex Brainman <alex.brainman@gmail.com>
Fri, 15 May 2015 03:25:41 +0000 (03:25 +0000)
commit335e44d265e7b7741b00237f4fcd97a1b80bfd9a
treea5e0c4c08032243fd731b379e258375d8af89b45
parented8ae79282f1ad8d06f926b366725c1be798289c
internal/syscall/windows/registry: fix read overrun in GetStringsValue

According to MSDN RegQueryValueEx page:

  If the data has the REG_SZ, REG_MULTI_SZ or REG_EXPAND_SZ type, the
  string may not have been stored with the proper terminating null
  characters. Therefore, even if the function returns ERROR_SUCCESS, the
  application should ensure that the string is properly terminated before
  using it; otherwise, it may overwrite a buffer. (Note that REG_MULTI_SZ
  strings should have two terminating null characters.)

Test written by Alex Brainman <alex.brainman@gmail.com>

Change-Id: I8c0852e0527e27ceed949134ed5e6de944189986
Reviewed-on: https://go-review.googlesource.com/9806
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
src/internal/syscall/windows/registry/export_test.go [new file with mode: 0644]
src/internal/syscall/windows/registry/registry_test.go
src/internal/syscall/windows/registry/value.go