File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change 4949
5050
5151 #if ( ipconfigUSE_DNS_CACHE == 1 ) || ( ipconfigDNS_USE_CALLBACKS == 1 )
52+
5253/**
5354 * @brief Read the Name field out of a DNS response packet.
5455 *
6465 size_t uxIndex = 0U ;
6566 size_t uxSourceLen = pxSet -> uxSourceBytesRemaining ;
6667 const uint8_t * pucByte = pxSet -> pucByte ;
67-
68+
6869 /* uxCount gets the values from pucByte and counts down to 0.
6970 * No need to have a different type than that of pucByte */
7071 size_t uxCount ;
71-
72+
7273 if ( uxSourceLen == ( size_t ) 0U )
7374 {
7475 /* Return 0 value in case of error. */
7576 uxIndex = 0U ;
7677 }
77-
78+
7879 /* Determine if the name is the fully coded name, or an offset to the name
7980 * elsewhere in the message. */
8081 else if ( ( pucByte [ uxIndex ] & dnsNAME_IS_OFFSET ) == dnsNAME_IS_OFFSET )
105106 pxSet -> pcName [ uxNameLen ] = '.' ;
106107 uxNameLen ++ ;
107108 }
108-
109+
109110 /* Process the first/next sub-string. */
110111 uxCount = ( size_t ) pucByte [ uxIndex ];
111-
112+
112113 /* uxIndex should point to the first character now, unless uxCount
113114 * is an offset field. */
114115 uxIndex ++ ;
115-
116+
116117 if ( ( uxIndex + uxCount ) > uxSourceLen )
117118 {
118119 uxIndex = 0U ;
119120 break ;
120121 }
121-
122+
122123 if ( ( uxNameLen + uxCount ) >= uxDestLen )
123124 {
124125 uxIndex = 0U ;
125126 break ;
126127 }
127-
128+
128129 while ( uxCount -- != 0U )
129130 {
130131 /*
136137 uxIndex ++ ;
137138 }
138139 }
139-
140+
140141 /* Confirm that a fully formed name was found. */
141142 if ( uxIndex > 0U )
142143 {
158159 }
159160 }
160161 }
161-
162+
162163 return uxIndex ;
163164 }
164165 #endif /* ipconfigUSE_DNS_CACHE || ipconfigDNS_USE_CALLBACKS */
You can’t perform that action at this time.
0 commit comments