- Notifications
You must be signed in to change notification settings - Fork28
Commit2ac5988
committed
Fix misparsing of non-newline-terminated pg_hba.conf files.
This back-patches the v10-cycle commit1e5a5d0 into 9.3 - 9.6.I had noticed at the time that that was fixing a bug, namely thatnext_token() might advance *lineptr past the line-terminating '\0',but given the lack of field complaints I too easily convinced myselfthat the problem was only latent. It's not, because tokenize_file()decides whether there's more on the line using "strlen(lineptr)".The bug is indeed latent on a newline-terminated line, because thenthe newline-stripping bit in tokenize_file() means we'll have twoor more consecutive '\0's in the buffer, masking the fact that weaccidentally advanced over the first one. But the last line inthe file might not be null-terminated, allowing the loop to seeand process garbage, as reported by Mark Jones in bug #14859.The bug doesn't exist in <= 9.2; there next_token() is reading directlyfrom a file, and termination of the outer loop relies on an feof() testnot a buffer pointer check. Probably commit7f49a67 can be blamedfor this bug, but I didn't track it down exactly.Commit1e5a5d0 does a bit more than the minimum needed to fix thebug, but I felt the rest of it was good cleanup, so applying it all.Discussion:https://postgr.es/m/20171017141814.8203.27280@wrigleys.postgresql.org1 parentaa1e9b3 commit2ac5988
1 file changed
+10
-20
lines changedLines changed: 10 additions & 20 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
141 | 141 |
| |
142 | 142 |
| |
143 | 143 |
| |
144 |
| - | |
| 144 | + | |
145 | 145 |
| |
146 | 146 |
| |
147 | 147 |
| |
148 | 148 |
| |
149 |
| - | |
150 | 149 |
| |
151 | 150 |
| |
152 | 151 |
| |
153 | 152 |
| |
154 | 153 |
| |
155 |
| - | |
| 154 | + | |
156 | 155 |
| |
157 | 156 |
| |
158 | 157 |
| |
159 |
| - | |
160 |
| - | |
161 |
| - | |
162 |
| - | |
163 |
| - | |
164 |
| - | |
165 | 158 |
| |
166 |
| - | |
167 |
| - | |
| 159 | + | |
| 160 | + | |
168 | 161 |
| |
169 |
| - | |
| 162 | + | |
170 | 163 |
| |
171 | 164 |
| |
172 | 165 |
| |
173 | 166 |
| |
174 | 167 |
| |
175 |
| - | |
| 168 | + | |
176 | 169 |
| |
177 |
| - | |
178 |
| - | |
179 |
| - | |
180 | 170 |
| |
181 | 171 |
| |
182 | 172 |
| |
| |||
188 | 178 |
| |
189 | 179 |
| |
190 | 180 |
| |
191 |
| - | |
| 181 | + | |
192 | 182 |
| |
193 | 183 |
| |
194 | 184 |
| |
195 | 185 |
| |
196 |
| - | |
| 186 | + | |
197 | 187 |
| |
198 | 188 |
| |
199 | 189 |
| |
| |||
221 | 211 |
| |
222 | 212 |
| |
223 | 213 |
| |
224 |
| - | |
225 |
| - | |
| 214 | + | |
| 215 | + | |
226 | 216 |
| |
227 | 217 |
| |
228 | 218 |
| |
|
0 commit comments
Comments
(0)