dnssd 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -9,12 +9,6 @@
9
9
 
10
10
  static VALUE cDNSSDTextRecord;
11
11
 
12
- static void
13
- dnssd_tr_decode_error(void)
14
- {
15
- rb_raise(rb_eArgError, "buffer contains invalid text record");
16
- }
17
-
18
12
  static void
19
13
  dnssd_tr_decode_buffer(VALUE self, long buf_len, const char *buf_ptr)
20
14
  {
@@ -24,18 +18,29 @@ dnssd_tr_decode_buffer(VALUE self, long buf_len, const char *buf_ptr)
24
18
  VALUE key, value;
25
19
  const char *p;
26
20
  long key_len, len = (long)(uint8_t)buf_ptr[i++];
27
- if (i >= buf_len || i + len > buf_len)
28
- dnssd_tr_decode_error();
21
+ if (i + len > buf_len)
22
+ rb_raise(rb_eArgError, "invalid text record (string longer than buffer)");
23
+
24
+ if (len == 0) {
25
+ /* 0-length key/value, handle this by skipping over it.
26
+ * Probably the RR should have zero-length, but some services have been
27
+ * found to advertise a non-zero length TXT record, with a zero-length
28
+ * key/value string.
29
+ */
30
+ continue;
31
+ }
29
32
 
30
- p = strchr(buf_ptr + i, '=');
33
+ p = memchr(buf_ptr + i, '=', buf_len - i);
31
34
  if (p == NULL) {
35
+ /* key, with no value, this is OK */
32
36
  key_len = len;
33
37
  key = rb_str_new(buf_ptr + i, key_len);
34
38
  value = Qnil;
35
39
  } else {
36
40
  key_len = p - (buf_ptr + i);
37
- if (key_len >= len)
38
- dnssd_tr_decode_error();
41
+ if(key_len == 0)
42
+ rb_raise(rb_eArgError, "invalid text record (zero-length key)");
43
+
39
44
  key = rb_str_new(buf_ptr + i, key_len);
40
45
  key_len++; /* step over '=' */
41
46
  value = rb_str_new(buf_ptr + i + key_len, len - key_len);
Binary file
File without changes
metadata CHANGED
@@ -1,47 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.1
3
- specification_version: 1
4
2
  name: dnssd
5
3
  version: !ruby/object:Gem::Version
6
- version: 0.6.0
7
- date: 2004-10-07
8
- summary: DNS Service Discovery (aka Rendezvous) API for Ruby
9
- require_paths:
10
- - lib
11
- - ext
12
- author: Charlie Mills
13
- email: cmills@freeshell.org
14
- homepage: http://dnssd.rubyforge.org
15
- rubyforge_project:
16
- description:
4
+ version: 0.7.0
5
+ platform: ruby
6
+ authors:
7
+ - Charlie Mills
17
8
  autorequire: dnssd
18
- default_executable:
19
9
  bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-08-05 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: cmills@freeshell.org
18
+ executables: []
19
+
20
+ extensions:
21
+ - ext/extconf.rb
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - lib/dnssd
26
+ - lib/dnssd.rb
27
+ - ext/dns_sd.h
28
+ - ext/extconf.rb
29
+ - ext/Makefile
30
+ - ext/MANIFEST
31
+ - ext/mkmf.log
32
+ - ext/rdnssd.bundle
33
+ - ext/rdnssd.c
34
+ - ext/rdnssd.h
35
+ - ext/rdnssd.o
36
+ - ext/rdnssd_service.c
37
+ - ext/rdnssd_service.o
38
+ - ext/rdnssd_structs.c
39
+ - ext/rdnssd_structs.o
40
+ - ext/rdnssd_tr.c
41
+ - ext/rdnssd_tr.o
42
+ - ext/run_rdoc
20
43
  has_rdoc: false
21
- required_ruby_version: !ruby/object:Gem::Version::Requirement
44
+ homepage: http://dnssd.rubyforge.org
45
+ post_install_message:
46
+ rdoc_options: []
47
+
48
+ require_paths:
49
+ - lib
50
+ - ext
51
+ required_ruby_version: !ruby/object:Gem::Requirement
22
52
  requirements:
23
- -
24
- - ">"
25
- - !ruby/object:Gem::Version
26
- version: 0.0.0
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ version:
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: "0"
27
62
  version:
28
- platform: ruby
29
- files:
30
- - lib/dnssd.rb
31
- - ext/dns_sd.h
32
- - ext/extconf.rb
33
- - ext/MANIFEST
34
- - ext/rdnssd.c
35
- - ext/rdnssd.h
36
- - ext/rdnssd_service.c
37
- - ext/rdnssd_structs.c
38
- - ext/rdnssd_tr.c
39
- - ext/run_rdoc
40
- test_files: []
41
- rdoc_options: []
42
- extra_rdoc_files: []
43
- executables: []
44
- extensions:
45
- - ext/extconf.rb
46
63
  requirements: []
47
- dependencies: []
64
+
65
+ rubyforge_project:
66
+ rubygems_version: 1.2.0
67
+ signing_key:
68
+ specification_version: 2
69
+ summary: DNS Service Discovery (aka Rendezvous) API for Ruby
70
+ test_files: []
71
+