#53 Wrong reserved length of key in dk->dk_b64len

v1.0.2
open
nobody
8
2011-06-09
2011-06-09
Alexander Pan'ko
No

Hi.

There is a problem.
Please look at line 1212 of dk.c.
"dk->dk_b64len = strlen(p + 1);"

This actually mean, that length saved to dk->dk_b64len will be less then length of "p" for 1.

This is fine for DNS records like:

$ host -t txt s1024._domainkey.yahoo.com
s1024._domainkey.yahoo.com descriptive text "k=rsa\; t=y\; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDrEee0Ri4Juz+QfiWYui/E9UGSXau/2P8LjnTD8V4Unn+2FAZVGE3kL23bzeoULYv4PeleB3gfm" "JiDJOKU3Ns5L4KJAUUHjFwDebt0NP+sBK0VKeTATL2Yr/S3bT/xhy+1xtj4RkdV7fVxTn56Lb4udUnwuxK4V5b5PdOKj/+XcwIDAQAB\; n=A 1024 bit key\;"

XXX._domainkey.XXXX.com. 600 IN TXT "k=rsa\; p=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAK9O8XQmkr7RAnRL3wMM50L56Q/pXN2/xIlEAlI7UxZqjKHqMPmQTsZwKJYehYpYly1WWIW2hFsGNk1m0g53FEUCAwEAAQ==\;"

But it is bad for Gmail key:
$ host -t txt gamma._domainkey.gmail.com
gamma._domainkey.gmail.com descriptive text "k=rsa\; t=y\; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDIhyR3oItOy22ZOaBrIVe9m/iME3RqOJeasANSpg2YTHTYV+Xtp4xwf5gTjCmHQEMOs0qYu0FYiNQPQogJ2t0Mfx9zNu06rfRBDjiIU9tpx2T+NGlWZ8qhbiLo5By8apJavLyqTLavyPSrvsx0B3YzC63T4Age2CDqZYA+OwSMWQIDAQAB"

There is no \; or just ";". So last letter "B" is eaten,

Patch for fixing this is in attachment.
Please apply it.

Discussion

  • Patch dk_b64len

     
    Attachments
    • priority: 5 --> 8