summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-09-09 13:30:45 -0700
committerGuy Harris <guy@alum.mit.edu>2016-09-09 13:31:00 -0700
commit1be808f4166f836fc0767b38b15bb1eef8c6b305 (patch)
tree7ed38ae30c74d8cb89f5cdd7703fda5fb05204f1
parent402792027413a3b90fe5a82d3a82a2ad1628e56d (diff)
downloadlibpcap-1be808f4166f836fc0767b38b15bb1eef8c6b305.tar.gz
Check for a null pointer supplied as the file name.
We already check for it when doing a live capture open; we might as well check for it when opening a file.
-rw-r--r--savefile.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/savefile.c b/savefile.c
index c0f1acb5..19c4675e 100644
--- a/savefile.c
+++ b/savefile.c
@@ -276,6 +276,11 @@ pcap_open_offline_with_tstamp_precision(const char *fname, u_int precision,
FILE *fp;
pcap_t *p;
+ if (fname == NULL) {
+ pcap_snprintf(errbuf, PCAP_ERRBUF_SIZE,
+ "A null pointer was supplied as the file name");
+ return (NULL);
+ }
if (fname[0] == '-' && fname[1] == '\0')
{
fp = stdin;