[Title] fix the Dereference before null check, Operands don't affect result
authorSooyoung Ha <yoosah.ha@samsung.com>
Thu, 10 Jan 2013 09:50:56 +0000 (18:50 +0900)
committerSooyoung Ha <yoosah.ha@samsung.com>
Thu, 10 Jan 2013 09:50:56 +0000 (18:50 +0900)
[Desc.] modify vmodem/at/at_rx_security.c, at_send.c, at_tx_sat.c

vmodem/at/at_rx_security.c
vmodem/at/at_send.c
vmodem/at/at_tx_sat.c

index d7a6db0..f349299 100644 (file)
@@ -573,6 +573,8 @@ static int at_rx_sim_sec_get_rsim_access_req(char* atmsg)
        
                int hexaStringSize = (len * 2) + 1;     
                char* hexaStringP = malloc(hexaStringSize);
+               if(!hexaStringP)
+                       return -1;
 
                TRACE(MSGL_VGSM_INFO, "hexaStringSize:%d\n", hexaStringSize);
 
index d99cf05..c7b54fa 100644 (file)
@@ -109,6 +109,8 @@ int at_msg_send(unsigned char ack, void *data, int datasize)
        if (datasize <= MAX_HDLC_FRAME_SIZE) {
            // allocate memory
            rawdata = malloc(datasize + 1);
+           if(!rawdata)
+                   return -1;
 
            // make at rawdata
            rc = make_single_at(data, datasize, rawdata);
index 79e85cf..6deb6c4 100644 (file)
@@ -46,10 +46,14 @@ int TxSAT_ATGetProactiveCommand(GSM_SatProactiveCmd const* pProactiveCmd)
 
        TRACE(MSGL_VGSM_INFO, "\n");
 
-       assert(!(pProactiveCmd->length&0xff00));
+       // this is always passed because (pProactiveCmd->length&0xff00) is always 0, so comment out
+       //assert(!(pProactiveCmd->length&0xff00));
 
        data[n++] = (pProactiveCmd->length)&0xff;
-       data[n++] = (pProactiveCmd->length >> 8)&0xff;
+       // this is always 0 because (pProactiveCmd->length >> 8) is 0, so fix like below
+       //data[n++] = (pProactiveCmd->length >> 8)&0xff;
+       data[n++] = 0;
+
        memcpy(&data[n], pProactiveCmd->cmd, pProactiveCmd->length);
        n += pProactiveCmd->length;