- /* Read the ARP cache entries. */
- for (; fgets(line, sizeof(line), fp);) {
- num = sscanf(line, "%s 0x%x 0x%x %100s %100s %100s\n",
- ip, &type, &flags, hwa, mask, dev);
- if (num < 4)
- break;
-
- entries++;
- /* if the user specified hw-type differs, skip it */
- if (hw_set && (type != hw->type))
- continue;
-
- /* if the user specified address differs, skip it */
- if (host[0] && strcmp(ip, host) != 0)
- continue;
-
- /* if the user specified device differs, skip it */
- if (device[0])
- continue;
-
- shown++;
- /* This IS ugly but it works -be */
- if (option_mask32 & ARP_OPT_n)
- hostname = "?";
- else {
- if (ap->input(0, ip, &sa) < 0)
- hostname = ip;
- else
- hostname = ap->sprint(&sa, (option_mask32 & ARP_OPT_n) | 0x8000);
- if (strcmp(hostname, ip) == 0)
- hostname = "?";
- }
+ /* All these strings can't overflow
+ * because fgets above reads limited amount of data */
+ num = sscanf(line, "%s 0x%x 0x%x %s %s %s\n",
+ ip, &type, &flags, hwa, mask, dev);
+ if (num < 4)
+ break;