]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Merge pull request #25 from dogbert2/master
authorMichael Richardson <[email protected]>
Wed, 5 Sep 2012 00:36:14 +0000 (17:36 -0700)
committerMichael Richardson <[email protected]>
Wed, 5 Sep 2012 00:36:14 +0000 (17:36 -0700)
Minor sanity checking added to addrtoname.c and tcpdump.c
To be followed by git rebase to remove changes to tests/*

.gitattributes [new file with mode: 0644]
addrtoname.c
tcpdump.c
tests/print-A.out
tests/print-AA.out

diff --git a/.gitattributes b/.gitattributes
new file mode 100644 (file)
index 0000000..6a39040
--- /dev/null
@@ -0,0 +1,26 @@
+# manage core stuff for LF normalization
+core.autocrlf=true
+
+# Auto detect text files and perform LF normalization
+* text=auto
+
+# Custom for Visual Studio
+*.cs     diff=csharp
+*.sln    merge=union
+*.csproj merge=union
+*.vbproj merge=union
+*.fsproj merge=union
+*.dbproj merge=union
+
+# Standard to msysgit
+*.doc   diff=astextplain
+*.DOC   diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot  diff=astextplain
+*.DOT  diff=astextplain
+*.pdf  diff=astextplain
+*.PDF   diff=astextplain
+*.rtf   diff=astextplain
+*.RTF   diff=astextplain
+#unix/linux stuff (tarballs)
index d77f27b0ac4fd999e29cf48fa8f49df82270582a..c92870dc324a68c0a7a5cb6937ea7f5169b760ce 100644 (file)
@@ -381,6 +381,9 @@ lookup_bytestring(register const u_char *bs, const unsigned int nlen)
        tp->e_addr2 = k;
 
        tp->e_bs = (u_char *) calloc(1, nlen + 1);
+       if (tp->e_bs == NULL)
+               error("lookup_bytestring: calloc");
+
        memcpy(tp->e_bs, bs, nlen);
        tp->e_nxt = (struct enamemem *)calloc(1, sizeof(*tp));
        if (tp->e_nxt == NULL)
index f21ec355943c8b0d817a801365bfd1ef1aedb037..98ec2d5df6ad14cfc554568c912a87c444353cb5 100644 (file)
--- a/tcpdump.c
+++ b/tcpdump.c
@@ -589,6 +589,8 @@ static void
 MakeFilename(char *buffer, char *orig_name, int cnt, int max_chars)
 {
         char *filename = malloc(NAME_MAX + 1);
+        if (filename == NULL)
+            error("Makefilename: malloc);
 
         /* Process with strftime if Gflag is set. */
         if (Gflag != 0) {
index 6765312868ead4de7943e5820b99dafb68bcc953..742a41d40ab3f3610ca76597f80af1bfc4e58b8c 100644 (file)
@@ -9,31 +9,31 @@ E..4.j@.@.!X.........p.P7X..7z.... .7......
 M...M...
 22:57:35.939423 IP 127.0.0.1.55920 > 127.0.0.1.80: Flags [P.], seq 1:203, ack 1, win 8192, options [nop,nop,TS val 1306300951 ecr 1306300950], length 202
 E....l@.@. ..........p.P7X..7z.... ........
-M...M...GET / HTTP/1.1\r
-Host: localhost\r
-User-Agent: ELinks/0.10.4-7-debian (textmode; Linux 2.6.11-1-686-smp i686; 132x56-2)\r
-Accept: */*\r
-Accept-Encoding: gzip\r
-Accept-Language: en\r
-Connection: Keep-Alive\r
-\r
+M...M...GET / HTTP/1.1
+Host: localhost
+User-Agent: ELinks/0.10.4-7-debian (textmode; Linux 2.6.11-1-686-smp i686; 132x56-2)
+Accept: */*
+Accept-Encoding: gzip
+Accept-Language: en
+Connection: Keep-Alive
+
 
 22:57:35.940474 IP 127.0.0.1.80 > 127.0.0.1.55920: Flags [.], ack 203, win 8192, options [nop,nop,TS val 1306300952 ecr 1306300951], length 0
 E..4..@[email protected].. .7......
 M...M...
 22:57:35.941232 IP 127.0.0.1.80 > 127.0.0.1.55920: Flags [P.], seq 1:5560, ack 203, win 8192, options [nop,nop,TS val 1306300953 ecr 1306300951], length 5559
 E.....@.@..%.........P.p7z..7X.I.. ........
-M...M...HTTP/1.1 200 OK\r
-Date: Wed, 06 Jul 2005 03:57:35 GMT\r
-Server: Apache/1.3.33\r
-Last-Modified: Sun, 15 Aug 2004 00:43:41 GMT\r
-ETag: "6e80f0-148a-411eb1bd"\r
-Accept-Ranges: bytes\r
-Content-Length: 5258\r
-Keep-Alive: timeout=15, max=100\r
-Connection: Keep-Alive\r
-Content-Type: text/html; charset=iso-8859-1\r
-\r
+M...M...HTTP/1.1 200 OK
+Date: Wed, 06 Jul 2005 03:57:35 GMT
+Server: Apache/1.3.33
+Last-Modified: Sun, 15 Aug 2004 00:43:41 GMT
+ETag: "6e80f0-148a-411eb1bd"
+Accept-Ranges: bytes
+Content-Length: 5258
+Keep-Alive: timeout=15, max=100
+Connection: Keep-Alive
+Content-Type: text/html; charset=iso-8859-1
+
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <HTML>
 <HEAD>
index 6a22df2be864e34bf4df39ddca9c2890c3d38ba4..13440504c44f3d4efbaf474b87d20d2c0ad1ec09 100644 (file)
@@ -9,31 +9,31 @@ M...M.......
 M...M...
 22:57:35.939423 IP 127.0.0.1.55920 > 127.0.0.1.80: Flags [P.], seq 1:203, ack 1, win 8192, options [nop,nop,TS val 1306300951 ecr 1306300950], length 202
 ..............E....l@.@. ..........p.P7X..7z.... ........
-M...M...GET / HTTP/1.1\r
-Host: localhost\r
-User-Agent: ELinks/0.10.4-7-debian (textmode; Linux 2.6.11-1-686-smp i686; 132x56-2)\r
-Accept: */*\r
-Accept-Encoding: gzip\r
-Accept-Language: en\r
-Connection: Keep-Alive\r
-\r
+M...M...GET / HTTP/1.1
+Host: localhost
+User-Agent: ELinks/0.10.4-7-debian (textmode; Linux 2.6.11-1-686-smp i686; 132x56-2)
+Accept: */*
+Accept-Encoding: gzip
+Accept-Language: en
+Connection: Keep-Alive
+
 
 22:57:35.940474 IP 127.0.0.1.80 > 127.0.0.1.55920: Flags [.], ack 203, win 8192, options [nop,nop,TS val 1306300952 ecr 1306300951], length 0
 ..............E..4..@[email protected].. .7......
 M...M...
 22:57:35.941232 IP 127.0.0.1.80 > 127.0.0.1.55920: Flags [P.], seq 1:5560, ack 203, win 8192, options [nop,nop,TS val 1306300953 ecr 1306300951], length 5559
 ..............E.....@.@..%.........P.p7z..7X.I.. ........
-M...M...HTTP/1.1 200 OK\r
-Date: Wed, 06 Jul 2005 03:57:35 GMT\r
-Server: Apache/1.3.33\r
-Last-Modified: Sun, 15 Aug 2004 00:43:41 GMT\r
-ETag: "6e80f0-148a-411eb1bd"\r
-Accept-Ranges: bytes\r
-Content-Length: 5258\r
-Keep-Alive: timeout=15, max=100\r
-Connection: Keep-Alive\r
-Content-Type: text/html; charset=iso-8859-1\r
-\r
+M...M...HTTP/1.1 200 OK
+Date: Wed, 06 Jul 2005 03:57:35 GMT
+Server: Apache/1.3.33
+Last-Modified: Sun, 15 Aug 2004 00:43:41 GMT
+ETag: "6e80f0-148a-411eb1bd"
+Accept-Ranges: bytes
+Content-Length: 5258
+Keep-Alive: timeout=15, max=100
+Connection: Keep-Alive
+Content-Type: text/html; charset=iso-8859-1
+
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <HTML>
 <HEAD>