Fossil SCM
Fix a potential segfault in the URL shortener of the WWW timeline logic.
Commit
d66718f2e88698a4d5e524fa9ca3cc2aef779829
Parent
d2bec5a1d4f7175…
1 file changed
+1
-1
+1
-1
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -35,11 +35,11 @@ | ||
| 35 | 35 | */ |
| 36 | 36 | static void shorten_uuid(char *zDest, const char *zSrc){ |
| 37 | 37 | int i; |
| 38 | 38 | for(i=0; i<10 && zSrc[i]<='9'; i++){} |
| 39 | 39 | memcpy(zDest, zSrc, 10); |
| 40 | - if( i==10 ){ | |
| 40 | + if( i==10 && zSrc[i] ){ | |
| 41 | 41 | do{ |
| 42 | 42 | zDest[i] = zSrc[i]; |
| 43 | 43 | i++; |
| 44 | 44 | }while( zSrc[i-1]<='9' ); |
| 45 | 45 | }else{ |
| 46 | 46 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -35,11 +35,11 @@ | |
| 35 | */ |
| 36 | static void shorten_uuid(char *zDest, const char *zSrc){ |
| 37 | int i; |
| 38 | for(i=0; i<10 && zSrc[i]<='9'; i++){} |
| 39 | memcpy(zDest, zSrc, 10); |
| 40 | if( i==10 ){ |
| 41 | do{ |
| 42 | zDest[i] = zSrc[i]; |
| 43 | i++; |
| 44 | }while( zSrc[i-1]<='9' ); |
| 45 | }else{ |
| 46 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -35,11 +35,11 @@ | |
| 35 | */ |
| 36 | static void shorten_uuid(char *zDest, const char *zSrc){ |
| 37 | int i; |
| 38 | for(i=0; i<10 && zSrc[i]<='9'; i++){} |
| 39 | memcpy(zDest, zSrc, 10); |
| 40 | if( i==10 && zSrc[i] ){ |
| 41 | do{ |
| 42 | zDest[i] = zSrc[i]; |
| 43 | i++; |
| 44 | }while( zSrc[i-1]<='9' ); |
| 45 | }else{ |
| 46 |