forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit23382c4
committed
Clean up code for widget_in() and widget_out().
Given syntactically wrong input, widget_in() could call atof() with anindeterminate pointer argument, typically leading to a crash; or if itdidn't do that, it might return a NULL pointer, which again would leadto a crash since old-style C functions aren't supposed to do thingsthat way. Fix that by correcting the off-by-one syntax test andthrowing a proper error rather than just returning NULL.Also, since widget_in and widget_out have been marked STRICT for along time, their tests for null inputs are just dead code; remove 'em.In the oldest branches, also improve widget_out to use snprintf notsprintf, just to be sure.In passing, get rid of a long-since-useless sprintf into a local bufferthat nothing further is done with, and make some other minor codingstyle cleanups.In the intended regression-testing usage of these functions, none ofthis is very significant; but if the regression test database wereleft around in a production installation, these bugs could amountto a minor security hazard.Piotr Stefaniak, Michael Paquier, and Tom Lane1 parentf2c6804 commit23382c4
1 file changed
+14
-15
lines changedLines changed: 14 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
244 | 244 |
| |
245 | 245 |
| |
246 | 246 |
| |
247 |
| - | |
248 |
| - | |
| 247 | + | |
249 | 248 |
| |
250 | 249 |
| |
251 | 250 |
| |
252 |
| - | |
253 |
| - | |
254 | 251 |
| |
255 |
| - | |
| 252 | + | |
| 253 | + | |
256 | 254 |
| |
257 |
| - | |
258 |
| - | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
259 | 263 |
| |
260 | 264 |
| |
261 | 265 |
| |
262 | 266 |
| |
263 | 267 |
| |
264 |
| - | |
265 |
| - | |
266 | 268 |
| |
267 | 269 |
| |
268 | 270 |
| |
| |||
271 | 273 |
| |
272 | 274 |
| |
273 | 275 |
| |
274 |
| - | |
275 |
| - | |
276 |
| - | |
277 |
| - | |
278 |
| - | |
279 |
| - | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
280 | 279 |
| |
281 | 280 |
| |
282 | 281 |
| |
|
0 commit comments
Comments
(0)