Fossil SCM
Replace a strdup() with fossil_strdup() to avoid a NULL deref if that dupe OOMs.
Commit
9de1f869ddf54f1ef3210d1ce2dca8baa89db16730160f3f233e749bed5bdf30
Parent
ab15b9c7da88e1b…
1 file changed
+1
-1
+1
-1
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -710,11 +710,11 @@ | ||
| 710 | 710 | int rc; |
| 711 | 711 | if( g.zBaseURL==0 ) return 0; |
| 712 | 712 | zRef = P("HTTP_REFERER"); |
| 713 | 713 | if( zRef==0 ) return 0; |
| 714 | 714 | if( strchr(zRef,'%')!=0 ){ |
| 715 | - zToFree = strdup(zRef); | |
| 715 | + zToFree = fossil_strdup(zRef); | |
| 716 | 716 | dehttpize(zToFree); |
| 717 | 717 | zRef = zToFree; |
| 718 | 718 | } |
| 719 | 719 | nBase = (int)strlen(g.zBaseURL); |
| 720 | 720 | if( fossil_strncmp(g.zBaseURL,zRef,nBase)!=0 ){ |
| 721 | 721 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -710,11 +710,11 @@ | |
| 710 | int rc; |
| 711 | if( g.zBaseURL==0 ) return 0; |
| 712 | zRef = P("HTTP_REFERER"); |
| 713 | if( zRef==0 ) return 0; |
| 714 | if( strchr(zRef,'%')!=0 ){ |
| 715 | zToFree = strdup(zRef); |
| 716 | dehttpize(zToFree); |
| 717 | zRef = zToFree; |
| 718 | } |
| 719 | nBase = (int)strlen(g.zBaseURL); |
| 720 | if( fossil_strncmp(g.zBaseURL,zRef,nBase)!=0 ){ |
| 721 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -710,11 +710,11 @@ | |
| 710 | int rc; |
| 711 | if( g.zBaseURL==0 ) return 0; |
| 712 | zRef = P("HTTP_REFERER"); |
| 713 | if( zRef==0 ) return 0; |
| 714 | if( strchr(zRef,'%')!=0 ){ |
| 715 | zToFree = fossil_strdup(zRef); |
| 716 | dehttpize(zToFree); |
| 717 | zRef = zToFree; |
| 718 | } |
| 719 | nBase = (int)strlen(g.zBaseURL); |
| 720 | if( fossil_strncmp(g.zBaseURL,zRef,nBase)!=0 ){ |
| 721 |