static analysis check of null dereference and memory management

This commit is contained in:
Jacob Barthelmeh
2016-12-21 16:20:18 -07:00
parent 1a5c5d0011
commit 1c17b8eed6
4 changed files with 12 additions and 3 deletions

View File

@@ -166,8 +166,9 @@ int main(int argc, char** argv)
printf("Enter the interface number (1-%d): ", i);
ret = scanf("%d", &inum);
if (ret != 1)
if (ret != 1) {
printf("scanf port failed\n");
}
if (inum < 1 || inum > i)
err_sys("Interface number out of range");