History

20090730-1933

forsyth committed 17 years ago

Commit 329dc891 parent 4c3002e6 files · +42 −1Browse files

Unified · Split

6 files
  1. CHANGES +2 −0
  2. include/version.h +1 −1
  3. libinterp/keyring.c +2 −0
  4. libkeyring/dsaalg.c +13 −0
  5. libkeyring/egalg.c +12 −0
  6. libkeyring/rsaalg.c +12 −0
CHANGES+2−0
@@ -1,3 +1,5 @@
1+20090730
2+ improve the error checking in strtosk and strtopk to help detect mangled or inappropriate keys
13 20090728
24 emu/port/main.c: put host's working directory name as emuwdir
35 document initial environment variables in emu(1)
include/version.h+1−1
@@ -1 +1 @@
1−#define VERSION "Fourth Edition (20090728)"
1+#define VERSION "Fourth Edition (20090730)"
libinterp/keyring.c+2−0
@@ -177,6 +177,8 @@ base64tobig(char *str, char **strp) · 176 unmodified lines
177177
178178 for(p = str; *p && *p != '\n'; p++)
179179 ;
180+ if(p == str)
181+ return nil;
180182 n = dec64(hex, sizeof(hex), str, p - str);
181183 b = betomp(hex, n, nil);
182184 if(strp){
libkeyring/dsaalg.c+13−0
@@ -25,6 +25,11 @@ dsa_str2sk(char *str, char **strp) · 24 unmodified lines
2525 dsa->secret = base64tobig(p, &p);
2626 if(strp)
2727 *strp = p;
28+ if(dsa->pub.p == nil || dsa->pub.q == nil ||
29+ dsa->pub.alpha == nil || dsa->pub.key == nil || dsa->secret == nil){
30+ dsaprivfree(dsa);
31+ return nil;
32+ }
2833 return dsa;
2934 }
3035
@@ -41,6 +46,10 @@ dsa_str2pk(char *str, char **strp) · 10 unmodified lines
4146 dsa->key = base64tobig(p, &p);
4247 if(strp)
4348 *strp = p;
49+ if(dsa->p == nil || dsa->q == nil || dsa->alpha == nil || dsa->key == nil){
50+ dsapubfree(dsa);
51+ return nil;
52+ }
4453 return dsa;
4554 }
4655
@@ -55,6 +64,10 @@ dsa_str2sig(char *str, char **strp) · 8 unmodified lines
5564 dsa->s = base64tobig(p, &p);
5665 if(strp)
5766 *strp = p;
67+ if(dsa->r == nil || dsa->s == nil){
68+ dsasigfree(dsa);
69+ return nil;
70+ }
5871 return dsa;
5972 }
6073
libkeyring/egalg.c+12−0
@@ -24,6 +24,10 @@ eg_str2sk(char *str, char **strp) · 23 unmodified lines
2424 eg->secret = base64tobig(p, &p);
2525 if(strp)
2626 *strp = p;
27+ if(eg->pub.p == nil || eg->pub.alpha == nil || eg->pub.key == nil || eg->secret == nil){
28+ egprivfree(eg);
29+ return nil;
30+ }
2731 return eg;
2832 }
2933
@@ -39,6 +43,10 @@ eg_str2pk(char *str, char **strp) · 9 unmodified lines
3943 eg->key = base64tobig(p, &p);
4044 if(strp)
4145 *strp = p;
46+ if(eg->p == nil || eg->alpha == nil || eg->key == nil){
47+ egpubfree(eg);
48+ return nil;
49+ }
4250 return eg;
4351 }
4452
@@ -53,6 +61,10 @@ eg_str2sig(char *str, char **strp) · 8 unmodified lines
5361 eg->s = base64tobig(p, &p);
5462 if(strp)
5563 *strp = p;
64+ if(eg->r == nil || eg->s == nil){
65+ egsigfree(eg);
66+ return nil;
67+ }
5668 return eg;
5769 }
5870
libkeyring/rsaalg.c+12−0
@@ -28,6 +28,12 @@ rsa_str2sk(char *str, char **strp) · 27 unmodified lines
2828 rsa->c2 = base64tobig(p, &p);
2929 if(strp)
3030 *strp = p;
31+ if(rsa->pub.n == nil || rsa->pub.ek == nil ||
32+ rsa->dk == nil || rsa->p == nil || rsa->q == nil ||
33+ rsa->kp == nil || rsa->kq == nil || rsa->c2 == nil){
34+ rsaprivfree(rsa);
35+ return nil;
36+ }
3137
3238 return rsa;
3339 }
@@ -43,6 +49,10 @@ rsa_str2pk(char *str, char **strp) · 9 unmodified lines
4349 rsa->ek = base64tobig(p, &p);
4450 if(strp)
4551 *strp = p;
52+ if(rsa->n == nil || rsa->ek == nil){
53+ rsapubfree(rsa);
54+ return nil;
55+ }
4656
4757 return rsa;
4858 }
@@ -54,6 +64,8 @@ rsa_str2sig(char *str, char **strp) · 5 unmodified lines
5464 char *p;
5565
5666 rsa = base64tobig(str, &p);
67+ if(rsa == nil)
68+ return nil;
5769 if(strp)
5870 *strp = p;
5971 return rsa;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t