Print this page
9886 libresolv2: fix fallthrough in ns_sprintrrf()


 877                         if (len < 0)
 878                                 goto formerr;
 879 
 880                         else if (len > 15) {
 881                                 T(addstr(" (", 2, &buf, &buflen));
 882                                 leader = "\n\t\t";
 883                                 spaced = 0;
 884                         }
 885                         else
 886                                 leader = " ";
 887 
 888                         for (n = 0; n < len; n += 48) {
 889                                 T(addstr(leader, strlen(leader),
 890                                          &buf, &buflen));
 891                                 T(addstr(base64_dhcid + n, MIN(len - n, 48),
 892                                          &buf, &buflen));
 893                         }
 894                         if (len > 15)
 895                                 T(addstr(" )", 2, &buf, &buflen));
 896                 }

 897         }
 898         /* FALLTHROUGH */
 899 
 900         case ns_t_ipseckey: {
 901                 int n;
 902                 unsigned int siz;
 903                 char base64_key[8192];
 904                 const char *leader;
 905         
 906                 if (rdlen < 2)
 907                         goto formerr;
 908 
 909                 switch (rdata[1]) {
 910                 case 0:
 911                 case 3:
 912                         if (rdlen < 3)
 913                                 goto formerr;
 914                         break;
 915                 case 1:
 916                         if (rdlen < 7)
 917                                 goto formerr;
 918                         break;


 969                         if (len < 0)
 970                                 goto formerr;
 971 
 972                         else if (len > 15) {
 973                                 T(addstr(" (", 2, &buf, &buflen));
 974                                 leader = "\n\t\t";
 975                                 spaced = 0;
 976                         }
 977                         else
 978                                 leader = " ";
 979 
 980                         for (n = 0; n < len; n += 48) {
 981                                 T(addstr(leader, strlen(leader),
 982                                          &buf, &buflen));
 983                                 T(addstr(base64_key + n, MIN(len - n, 48),
 984                                          &buf, &buflen));
 985                         }
 986                         if (len > 15)
 987                                 T(addstr(" )", 2, &buf, &buflen));
 988                 }

 989         }
 990         /* FALLTHROUGH */
 991 
 992         case ns_t_hip: {
 993                 unsigned int i, hip_len, algorithm, key_len;
 994                 char base64_key[NS_MD5RSA_MAX_BASE64];
 995                 unsigned int siz;
 996                 const char *leader = "\n\t\t\t\t\t";
 997                 
 998                 hip_len = *rdata++;
 999                 algorithm = *rdata++;
1000                 key_len = ns_get16(rdata);
1001                 rdata += NS_INT16SZ;
1002 
1003                 siz = key_len*4/3 + 4; /* "+4" accounts for trailing \0 */
1004                 if (siz > sizeof(base64_key) * 3/4) {
1005                         const char *str = "record too long to print";
1006                         T(addstr(str, strlen(str), &buf, &buflen));
1007                 } else {
1008                         len = sprintf(tmp, "( %u ", algorithm);
1009                         T(addstr(tmp, len, &buf, &buflen));
1010 




 877                         if (len < 0)
 878                                 goto formerr;
 879 
 880                         else if (len > 15) {
 881                                 T(addstr(" (", 2, &buf, &buflen));
 882                                 leader = "\n\t\t";
 883                                 spaced = 0;
 884                         }
 885                         else
 886                                 leader = " ";
 887 
 888                         for (n = 0; n < len; n += 48) {
 889                                 T(addstr(leader, strlen(leader),
 890                                          &buf, &buflen));
 891                                 T(addstr(base64_dhcid + n, MIN(len - n, 48),
 892                                          &buf, &buflen));
 893                         }
 894                         if (len > 15)
 895                                 T(addstr(" )", 2, &buf, &buflen));
 896                 }
 897                 break;
 898         }

 899 
 900         case ns_t_ipseckey: {
 901                 int n;
 902                 unsigned int siz;
 903                 char base64_key[8192];
 904                 const char *leader;
 905         
 906                 if (rdlen < 2)
 907                         goto formerr;
 908 
 909                 switch (rdata[1]) {
 910                 case 0:
 911                 case 3:
 912                         if (rdlen < 3)
 913                                 goto formerr;
 914                         break;
 915                 case 1:
 916                         if (rdlen < 7)
 917                                 goto formerr;
 918                         break;


 969                         if (len < 0)
 970                                 goto formerr;
 971 
 972                         else if (len > 15) {
 973                                 T(addstr(" (", 2, &buf, &buflen));
 974                                 leader = "\n\t\t";
 975                                 spaced = 0;
 976                         }
 977                         else
 978                                 leader = " ";
 979 
 980                         for (n = 0; n < len; n += 48) {
 981                                 T(addstr(leader, strlen(leader),
 982                                          &buf, &buflen));
 983                                 T(addstr(base64_key + n, MIN(len - n, 48),
 984                                          &buf, &buflen));
 985                         }
 986                         if (len > 15)
 987                                 T(addstr(" )", 2, &buf, &buflen));
 988                 }
 989                 break;
 990         }

 991 
 992         case ns_t_hip: {
 993                 unsigned int i, hip_len, algorithm, key_len;
 994                 char base64_key[NS_MD5RSA_MAX_BASE64];
 995                 unsigned int siz;
 996                 const char *leader = "\n\t\t\t\t\t";
 997                 
 998                 hip_len = *rdata++;
 999                 algorithm = *rdata++;
1000                 key_len = ns_get16(rdata);
1001                 rdata += NS_INT16SZ;
1002 
1003                 siz = key_len*4/3 + 4; /* "+4" accounts for trailing \0 */
1004                 if (siz > sizeof(base64_key) * 3/4) {
1005                         const char *str = "record too long to print";
1006                         T(addstr(str, strlen(str), &buf, &buflen));
1007                 } else {
1008                         len = sprintf(tmp, "( %u ", algorithm);
1009                         T(addstr(tmp, len, &buf, &buflen));
1010