Text   |  XML   |  ReML   |   Visible Warnings:

Null Test After Dereference  at packet-ntlmssp.c:1091

No properties have been set. | edit properties
Jump to warning location ↓ warning details...
Show Events | Options

dissect_ntlmssp_auth

(/home/sate/Testcases/c/cve/wireshark-1.2.0/epan/dissectors/packet-ntlmssp.c)expand/collapse
Show more  
 1020  dissect_ntlmssp_auth (tvbuff_t *tvb, packet_info *pinfo, int offset,
 1021                        proto_tree *ntlmssp_tree, ntlmssp_header_t *ntlmssph)
 1022  {
 1023    int item_start, item_end;
 1024    int data_start, data_end = 0;
 1025    guint32 negotiate_flags;
 1026    gboolean unicode_strings = FALSE;
 1027    ntlmssp_info *conv_ntlmssp_info;
 1028    conversation_t *conversation;
 1029   
 1030    /*
 1031     * Get flag info from the original negotiate message, if any.
 1032     * This is because the flag information is sometimes missing from
 1033     * the AUTHENTICATE message, so we can't figure out whether 
 1034     * strings are Unicode or not by looking at *our* flags.
 1035     */
 1036    conv_ntlmssp_info = p_get_proto_data(pinfo->fd, proto_ntlmssp);
 1037    if (conv_ntlmssp_info == NULL) {
 1038      /*
 1039       * There isn't any.  Is there any from this conversation?  If so,
 1040       * it means this is the first time we've dissected this frame, so 
 1041       * we should give it flag info.
 1042       */
 1043      conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst,
 1044                                       pinfo->ptype, pinfo->srcport,
 1045                                       pinfo->destport, 0);
 1046      if (conversation != NULL) {
 1047        conv_ntlmssp_info = conversation_get_proto_data(conversation, proto_ntlmssp);
 1048        if (conv_ntlmssp_info != NULL) {
 1049          /*
 1050           * We have flag info; attach it to the frame.
 1051           */
 1052          p_add_proto_data(pinfo->fd, proto_ntlmssp, conv_ntlmssp_info);
 1053        }
 1054      }
 1055    }
 1056    if (conv_ntlmssp_info != NULL) {
 1057      if (conv_ntlmssp_info->flags & NTLMSSP_NEGOTIATE_UNICODE)
 1058        unicode_strings = TRUE;
 1059    }
 1060   
 1061    /*
 1062     * Sometimes the session key and flags are missing.
 1063     * Sometimes the session key is present but the flags are missing.
 1064     * Sometimes they're both present.
 1065     *
 1066     * This does not correlate with any flags in the previous CHALLENGE 
 1067     * message, and only correlates with "Negotiate Unicode", "Workstation
 1068     * Supplied", and "Domain Supplied" in the NEGOTIATE message - but 
 1069     * those don't make sense as flags to use to determine this.
 1070     *
 1071     * So we check all of the descriptors to figure out where the data 
 1072     * area begins, and if the session key or the flags would be in the
 1073     * middle of the data area, we assume the field in question is 
 1074     * missing.
 1075     */
 1076   
 1077    /* Lan Manager response */
 1078    data_start = tvb_get_letohl(tvb, offset+4);
 1079    offset = dissect_ntlmssp_blob(tvb, offset, ntlmssp_tree,
 1080                                  hf_ntlmssp_auth_lmresponse,
 1081                                  &item_end,
 1082                                  conv_ntlmssp_info == NULL ? NULL :
 1083                                      &conv_ntlmssp_info->lm_response);
 1084    data_end = MAX(data_end, item_end);
 1085   
 1086    /* NTLM response */
 1087    item_start = tvb_get_letohl(tvb, offset+4);
 1088    offset = dissect_ntlmssp_blob(tvb, offset, ntlmssp_tree,
 1089                                  hf_ntlmssp_auth_ntresponse,
 1090                                  &item_end,
 1091                                  conv_ntlmssp_info == NULL ? NULL :
 1092                                  &conv_ntlmssp_info->ntlm_response);
 1093    data_start = MIN(data_start, item_start);
 1094    data_end = MAX(data_end, item_end);
 1095   
 1096    /* domain name */
 1097    item_start = tvb_get_letohl(tvb, offset+4);
 1098    offset = dissect_ntlmssp_string(tvb, offset, ntlmssp_tree,
 1099                                    unicode_strings,
 1100                                    hf_ntlmssp_auth_domain,
 1101                                    &item_start, &item_end, &(ntlmssph->domain_name));
 1102    data_start = MIN(data_start, item_start);
 1103    data_end = MAX(data_end, item_end);
 1104   
 1105    /* user name */
 1106    item_start = tvb_get_letohl(tvb, offset+4);
 1107    offset = dissect_ntlmssp_string(tvb, offset, ntlmssp_tree,
 1108                                    unicode_strings,
 1109                                    hf_ntlmssp_auth_username,
 1110                                    &item_start, &item_end, &(ntlmssph->acct_name));
 1111    data_start = MIN(data_start, item_start);
 1112    data_end = MAX(data_end, item_end);
 1113   
 1114    if (check_col(pinfo->cinfo, COL_INFO))
 1115      col_append_fstr(pinfo->cinfo, COL_INFO, ", User: %s\\%s",
 1116                      ntlmssph->domain_name, ntlmssph->acct_name);
 1117   
 1118    /* hostname */
 1119    item_start = tvb_get_letohl(tvb, offset+4);
 1120    offset = dissect_ntlmssp_string(tvb, offset, ntlmssp_tree,
 1121                                    unicode_strings,
 1122                                    hf_ntlmssp_auth_hostname,
 1123                                    &item_start, &item_end, &(ntlmssph->host_name));
 1124    data_start = MIN(data_start, item_start);
 1125    data_end = MAX(data_end, item_end);
 1126   
 1127    if (offset < data_start) {
 1128      /* Session Key */
 1129      offset = dissect_ntlmssp_blob(tvb, offset, ntlmssp_tree,
 1130                                    hf_ntlmssp_auth_sesskey,
 1131                                    &item_end, NULL);
 1132      data_end = MAX(data_end, item_end);
 1133    }
 1134   
 1135    if (offset < data_start) {
 1136      /* NTLMSSP Negotiate Flags */
 1137      negotiate_flags = tvb_get_letohl (tvb, offset);
 1138      offset = dissect_ntlmssp_negotiate_flags (tvb, offset, ntlmssp_tree,
 1139                                                negotiate_flags);
 1140    }
 1141   
 1142    return MAX(offset, data_end);
 1143  }
Show more  




Change Warning 12401.33869 : Null Test After Dereference

Because they are very similar, this warning shares annotations with warning 12401.33870.

Priority:
State:
Finding:
Owner:
Note: