Diffstat (limited to 'noncore/net/wellenreiter/libwellenreiter/source/sniff.cc') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/libwellenreiter/source/sniff.cc | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc b/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc index 81eccab..3c227ab 100644 --- a/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc +++ b/noncore/net/wellenreiter/libwellenreiter/source/sniff.cc | |||
@@ -175,15 +175,30 @@ void etheraddr_string(register const u_char *ep, char *text) | |||
175 | static char hex[] = "0123456789abcdef"; | 175 | static char hex[] = "0123456789abcdef"; |
176 | register unsigned int i, j; | 176 | register unsigned int i, j; |
177 | register char *cp; | 177 | register char *cp; |
178 | char buf[sizeof("00:00:00:00:00:00")]; | 178 | char buf[sizeof("00:00:00:00:00:00\0")]; |
179 | cp = buf; | 179 | cp = buf; |
180 | if ((j = *ep >> 4) != 0) | 180 | if ((j = *ep >> 4) != 0) |
181 | *cp++ = hex[j]; | 181 | { |
182 | *cp++ = hex[j]; | ||
183 | } | ||
184 | else | ||
185 | { | ||
186 | *cp++ = '0'; | ||
187 | } | ||
182 | *cp++ = hex[*ep++ & 0xf]; | 188 | *cp++ = hex[*ep++ & 0xf]; |
183 | for (i = 5; (int)--i >= 0;) { | 189 | |
190 | for (i = 5; (int)--i >= 0;) | ||
191 | { | ||
184 | *cp++ = ':'; | 192 | *cp++ = ':'; |
185 | if ((j = *ep >> 4) != 0) | 193 | if ((j = *ep >> 4) != 0) |
186 | *cp++ = hex[j]; | 194 | { |
195 | *cp++ = hex[j]; | ||
196 | } | ||
197 | else | ||
198 | { | ||
199 | *cp++ = '0'; | ||
200 | } | ||
201 | |||
187 | *cp++ = hex[*ep++ & 0xf]; | 202 | *cp++ = hex[*ep++ & 0xf]; |
188 | } | 203 | } |
189 | *cp = '\0'; | 204 | *cp = '\0'; |