forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit1e5a5d0
committed
Simplify some long-obsolete code in hba.c's next_token().
next_token() oddly set its buffer space consumption limit to one beforethe last char position in the buffer, not the last as you'd expect.The reason is there was once an ugly kluge to mark keywords by appendinga newline to them, potentially requiring one more byte. Commite5e2fc8removed that kluge, but failed to notice that the length limit could beincreased.Also, remove some vestigial handling of newline characters in the buffer.That was left over from when this function read the file directly usinggetc(). Commit7f49a67 changed it to read from a buffer, from whichtokenize_file had already removed the only possible occurrence of newline,but did not simplify this function in consequence.Also, ensure that we don't return with *lineptr set to someplace past theterminating '\0'; that would be catastrophic if a caller were to ask foranother token from the same line. This is just latent since no callersactually do call again after a "false" return; but considering that it wasactually costing us extra code to do it wrong, we might as well make itbulletproof.Noted while reviewing pg_hba_file_rules patch.1 parentde16ab7 commit1e5a5d0
1 file changed
+12
-20
lines changedLines changed: 12 additions & 20 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
197 | 197 |
| |
198 | 198 |
| |
199 | 199 |
| |
200 |
| - | |
| 200 | + | |
201 | 201 |
| |
202 | 202 |
| |
203 | 203 |
| |
204 | 204 |
| |
205 |
| - | |
206 | 205 |
| |
207 | 206 |
| |
208 | 207 |
| |
209 | 208 |
| |
210 | 209 |
| |
211 |
| - | |
| 210 | + | |
212 | 211 |
| |
213 | 212 |
| |
214 | 213 |
| |
215 |
| - | |
216 |
| - | |
217 |
| - | |
218 |
| - | |
219 |
| - | |
220 |
| - | |
221 | 214 |
| |
222 |
| - | |
223 |
| - | |
| 215 | + | |
| 216 | + | |
224 | 217 |
| |
225 |
| - | |
| 218 | + | |
226 | 219 |
| |
227 | 220 |
| |
228 | 221 |
| |
229 | 222 |
| |
230 | 223 |
| |
231 |
| - | |
| 224 | + | |
232 | 225 |
| |
233 |
| - | |
234 |
| - | |
235 |
| - | |
236 | 226 |
| |
237 | 227 |
| |
238 | 228 |
| |
| |||
245 | 235 |
| |
246 | 236 |
| |
247 | 237 |
| |
248 |
| - | |
| 238 | + | |
249 | 239 |
| |
| 240 | + | |
| 241 | + | |
250 | 242 |
| |
251 | 243 |
| |
252 | 244 |
| |
253 |
| - | |
| 245 | + | |
254 | 246 |
| |
255 | 247 |
| |
256 | 248 |
| |
| |||
278 | 270 |
| |
279 | 271 |
| |
280 | 272 |
| |
281 |
| - | |
282 |
| - | |
| 273 | + | |
| 274 | + | |
283 | 275 |
| |
284 | 276 |
| |
285 | 277 |
| |
|
0 commit comments
Comments
(0)