aboutsummaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-connectivity/dibbler/dibbler/dibbler_fix_getSize_crash.patch
blob: 439ef1177d00d95a69f272560a64e82c523b751d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Upstream-Status: Pending

Index: git/ClntMessages/ClntMsgRequest.cpp
===================================================================
--- git.orig/ClntMessages/ClntMsgRequest.cpp
+++ git/ClntMessages/ClntMsgRequest.cpp
@@ -142,7 +142,10 @@ TClntMsgRequest::TClntMsgRequest(List(TA
     IsDone=false;
     SPtr<TOpt> ptr;
     ptr = new TOptDUID(OPTION_CLIENTID, ClntCfgMgr().getDUID(), this );
-    Options.push_back( ptr );
+
+    if ( ptr ) { 
+        Options.push_back( ptr );
+    }
 
     if (!srvDUID) {
 	Log(Error) << "Unable to send REQUEST: ServerId not specified.\n" << LogEnd;
@@ -153,7 +156,9 @@ TClntMsgRequest::TClntMsgRequest(List(TA
     ptr = new TOptDUID(OPTION_SERVERID, srvDUID,this);
     // all IAs provided by checkSolicit
     SPtr<TAddrIA> ClntAddrIA;
-    Options.push_back( ptr );
+    if ( ptr ) {
+        Options.push_back( ptr );
+    }
 	
     IAs.first();
     while (ClntAddrIA = IAs.get()) 
Index: git/Messages/Msg.cpp
===================================================================
--- git.orig/Messages/Msg.cpp
+++ git/Messages/Msg.cpp
@@ -69,10 +69,15 @@ int TMsg::getSize()
 {
     int pktsize=0;
     TOptList::iterator opt;
+    int optionCount = 0;
     for (opt = Options.begin(); opt!=Options.end(); ++opt)
     {
-	pktsize += (*opt)->getSize();
+       Log(Info) << "### CPE Debug - Option with index  " << optionCount++ << LogEnd ;
+       Log(Info) << "### CPE Debug - Option with type " << (*opt)->getOptType() << LogEnd ;
+       pktsize += (*opt)->getSize();
     }
+    Log(Info) << "### CPE Debug - Packet size of option (Add 4) " << pktsize << LogEnd ;
+
     return pktsize + 4;
 }