Skip to content

Commit 8e053dc

Browse files
committed
Fix possible NULL-pointer-deference in backup_compression.c.
Per Coverity and Tom Lane. Reviewed by Tom Lane and Justin Pryzby. Discussion: http://postgr.es/m/384291.1648403267@sss.pgh.pa.us
1 parent 027fa0f commit 8e053dc

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/common/backup_compression.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,16 @@ parse_bc_specification(bc_algorithm algorithm, char *specification,
191191
if (value != NULL)
192192
pfree(value);
193193

194-
/* If we got an error or have reached the end of the string, stop. */
195-
if (result->parse_error != NULL || *kwend == '\0' || *vend == '\0')
194+
/*
195+
* If we got an error or have reached the end of the string, stop.
196+
*
197+
* If there is no value, then the end of the keyword might have been
198+
* the end of the string. If there is a value, then the end of the
199+
* keyword cannot have been the end of the string, but the end of the
200+
* value might have been.
201+
*/
202+
if (result->parse_error != NULL ||
203+
(vend == NULL ? *kwend == '\0' : *vend == '\0'))
196204
break;
197205

198206
/* Advance to next entry and loop around. */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy