Header: allocate memory for terminating entry

The names array is terminated by a NULL entry, thus allocate space for
one more than entries.

Fixes: #844

==6708==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6060000045b8 at pc 0x000000589ee1 bp 0x7ffcd1dee220 sp 0x7ffcd1dee218
READ of size 8 at 0x6060000045b8 thread T0
    #0 0x589ee0 in String_freeArray ./XUtils.c:157:23
    #1 0x56c9af in Settings_delete ./Settings.c:31:7
    #2 0x4ee44b in CommandLine_run ./CommandLine.c:395:4
    #3 0x4d6fb2 in main ./htop.c:15:11
    #4 0x7ff3b8154e49 in __libc_start_main csu/../csu/libc-start.c:314:16
    #5 0x428aa9 in _start (./htop+0x428aa9)

0x6060000045b8 is located 0 bytes to the right of 56-byte region [0x606000004580,0x6060000045b8)
allocated by thread T0 here:
    #0 0x4a53f2 in __interceptor_calloc (./htop+0x4a53f2)
    #1 0x5890ba in xCalloc ./XUtils.c:55:17
    #2 0x50a044 in Header_writeBackToSettings ./Header.c:148:34
    #3 0x4de861 in Action_runSetup ./Action.c:91:7
    #4 0x4de861 in actionSetup ./Action.c:386:4
    #5 0x515caf in MainPanel_eventHandler ./MainPanel.c:106:19
    #6 0x56a5c1 in ScreenManager_run ./ScreenManager.c:235:19
    #7 0x4ee13b in CommandLine_run ./CommandLine.c:364:4
    #8 0x4d6fb2 in main ./htop.c:15:11
    #9 0x7ff3b8154e49 in __libc_start_main csu/../csu/libc-start.c:314:16
1 file changed
tree: 05f41923de7c1e4f372f6be16608efcf2b64f79a
  1. .github/
  2. darwin/
  3. docs/
  4. dragonflybsd/
  5. freebsd/
  6. generic/
  7. iwyu/
  8. linux/
  9. netbsd/
  10. openbsd/
  11. pcp/
  12. scripts/
  13. solaris/
  14. unsupported/
  15. zfs/
  16. .editorconfig
  17. .gitignore
  18. .travis.yml
  19. Action.c
  20. Action.h
  21. Affinity.c
  22. Affinity.h
  23. AffinityPanel.c
  24. AffinityPanel.h
  25. AUTHORS
  26. autogen.sh
  27. AvailableColumnsPanel.c
  28. AvailableColumnsPanel.h
  29. AvailableMetersPanel.c
  30. AvailableMetersPanel.h
  31. BatteryMeter.c
  32. BatteryMeter.h
  33. CategoriesPanel.c
  34. CategoriesPanel.h
  35. ChangeLog
  36. ClockMeter.c
  37. ClockMeter.h
  38. ColorsPanel.c
  39. ColorsPanel.h
  40. ColumnsPanel.c
  41. ColumnsPanel.h
  42. CommandLine.c
  43. CommandLine.h
  44. CommandScreen.c
  45. CommandScreen.h
  46. Compat.c
  47. Compat.h
  48. configure.ac
  49. CONTRIBUTING.md
  50. COPYING
  51. CPUMeter.c
  52. CPUMeter.h
  53. CRT.c
  54. CRT.h
  55. DateMeter.c
  56. DateMeter.h
  57. DateTimeMeter.c
  58. DateTimeMeter.h
  59. DiskIOMeter.c
  60. DiskIOMeter.h
  61. DisplayOptionsPanel.c
  62. DisplayOptionsPanel.h
  63. DynamicColumn.c
  64. DynamicColumn.h
  65. DynamicMeter.c
  66. DynamicMeter.h
  67. EnvScreen.c
  68. EnvScreen.h
  69. FunctionBar.c
  70. FunctionBar.h
  71. Hashtable.c
  72. Hashtable.h
  73. Header.c
  74. Header.h
  75. HeaderLayout.h
  76. HeaderOptionsPanel.c
  77. HeaderOptionsPanel.h
  78. HostnameMeter.c
  79. HostnameMeter.h
  80. htop.1.in
  81. htop.c
  82. htop.desktop
  83. htop.png
  84. htop.svg
  85. IncSet.c
  86. IncSet.h
  87. InfoScreen.c
  88. InfoScreen.h
  89. ListItem.c
  90. ListItem.h
  91. LoadAverageMeter.c
  92. LoadAverageMeter.h
  93. Macros.h
  94. MainPanel.c
  95. MainPanel.h
  96. Makefile.am
  97. MemoryMeter.c
  98. MemoryMeter.h
  99. MemorySwapMeter.c
  100. MemorySwapMeter.h
  101. Meter.c
  102. Meter.h
  103. MetersPanel.c
  104. MetersPanel.h
  105. NetworkIOMeter.c
  106. NetworkIOMeter.h
  107. NEWS
  108. Object.c
  109. Object.h
  110. OpenFilesScreen.c
  111. OpenFilesScreen.h
  112. OptionItem.c
  113. OptionItem.h
  114. Panel.c
  115. Panel.h
  116. pcp-htop.5.in
  117. pcp-htop.c
  118. Process.c
  119. Process.h
  120. ProcessList.c
  121. ProcessList.h
  122. ProcessLocksScreen.c
  123. ProcessLocksScreen.h
  124. ProvideCurses.h
  125. README
  126. RichString.c
  127. RichString.h
  128. ScreenManager.c
  129. ScreenManager.h
  130. Settings.c
  131. Settings.h
  132. SignalsPanel.c
  133. SignalsPanel.h
  134. SwapMeter.c
  135. SwapMeter.h
  136. SysArchMeter.c
  137. SysArchMeter.h
  138. TasksMeter.c
  139. TasksMeter.h
  140. test_spec.lua
  141. TESTPLAN
  142. TraceScreen.c
  143. TraceScreen.h
  144. UptimeMeter.c
  145. UptimeMeter.h
  146. UsersTable.c
  147. UsersTable.h
  148. Vector.c
  149. Vector.h
  150. XUtils.c
  151. XUtils.h