Fossil SCM

Fix a potential segfault on "fossil pull". Ticket [71439c64b8d6af66f5e34].

drh 2010-10-09 17:18 trunk
Commit 26c262cd03144e92205cb15a0121ae9288f42ace
1 file changed +2
--- src/encode.c
+++ src/encode.c
@@ -530,10 +530,11 @@
530530
char *obscure(const char *zIn){
531531
int n, i;
532532
unsigned char salt;
533533
char *zOut;
534534
535
+ if( zIn==0 ) return 0;
535536
n = strlen(zIn);
536537
zOut = malloc( n*2+3 );
537538
if( zOut==0 ) fossil_panic("out of memory");
538539
sqlite3_randomness(1, &salt);
539540
zOut[n+1] = (char)salt;
@@ -552,10 +553,11 @@
552553
char *unobscure(const char *zIn){
553554
int n, i;
554555
unsigned char salt;
555556
char *zOut;
556557
558
+ if( zIn==0 ) return 0;
557559
n = strlen(zIn);
558560
zOut = malloc( n + 1 );
559561
if( zOut==0 ) fossil_panic("out of memory");
560562
if( n<2
561563
|| decode16((unsigned char*)zIn, &salt, 2)
562564
--- src/encode.c
+++ src/encode.c
@@ -530,10 +530,11 @@
530 char *obscure(const char *zIn){
531 int n, i;
532 unsigned char salt;
533 char *zOut;
534
 
535 n = strlen(zIn);
536 zOut = malloc( n*2+3 );
537 if( zOut==0 ) fossil_panic("out of memory");
538 sqlite3_randomness(1, &salt);
539 zOut[n+1] = (char)salt;
@@ -552,10 +553,11 @@
552 char *unobscure(const char *zIn){
553 int n, i;
554 unsigned char salt;
555 char *zOut;
556
 
557 n = strlen(zIn);
558 zOut = malloc( n + 1 );
559 if( zOut==0 ) fossil_panic("out of memory");
560 if( n<2
561 || decode16((unsigned char*)zIn, &salt, 2)
562
--- src/encode.c
+++ src/encode.c
@@ -530,10 +530,11 @@
530 char *obscure(const char *zIn){
531 int n, i;
532 unsigned char salt;
533 char *zOut;
534
535 if( zIn==0 ) return 0;
536 n = strlen(zIn);
537 zOut = malloc( n*2+3 );
538 if( zOut==0 ) fossil_panic("out of memory");
539 sqlite3_randomness(1, &salt);
540 zOut[n+1] = (char)salt;
@@ -552,10 +553,11 @@
553 char *unobscure(const char *zIn){
554 int n, i;
555 unsigned char salt;
556 char *zOut;
557
558 if( zIn==0 ) return 0;
559 n = strlen(zIn);
560 zOut = malloc( n + 1 );
561 if( zOut==0 ) fossil_panic("out of memory");
562 if( n<2
563 || decode16((unsigned char*)zIn, &salt, 2)
564

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button