Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Commit

Permalink
check arguments to prevent segv
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Mar 24, 2015
1 parent 816e754 commit bc9b2cd
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions ext/dnssd/service.c
Expand Up @@ -527,14 +527,23 @@ dnssd_service_register(VALUE klass, VALUE _flags, VALUE _interface, VALUE _name,
DNSServiceRef *client;
VALUE self;

dnssd_utf8_cstr(_name, name);
if (!NIL_P(_name)) {
Check_Type(_name, T_STRING);
dnssd_utf8_cstr(_name, name);
}

Check_Type(_type, T_STRING);
dnssd_utf8_cstr(_type, type);

if (!NIL_P(_host))
if (!NIL_P(_host)) {
Check_Type(_host, T_STRING);
dnssd_utf8_cstr(_host, host);
}

if (!NIL_P(_domain))
if (!NIL_P(_domain)) {
Check_Type(_domain, T_STRING);
dnssd_utf8_cstr(_domain, domain);
}

port = htons((uint16_t)NUM2UINT(_port));

Expand Down

0 comments on commit bc9b2cd

Please sign in to comment.