Skip to content

Commit

Permalink
DNS LULZ
Browse files Browse the repository at this point in the history
  • Loading branch information
robertdavidgraham committed Oct 10, 2013
1 parent 678d874 commit b1d0d28
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/ranges.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ rangelist_add_range(struct RangeList *task, unsigned begin, unsigned end)

/* auto-expand the list if necessary */
if (task->count + 1 >= task->max) {
unsigned new_max = task->max * 2 + 1;
size_t new_max = (size_t)task->max * 2 + 1;
struct Range *new_list;

if ((size_t)new_max >= SIZE_MAX/sizeof(*new_list))
if (new_max >= SIZE_MAX/sizeof(*new_list))
exit(1); /* integer overflow */
new_list = (struct Range *)malloc(sizeof(*new_list) * new_max);
if (new_list == NULL)
Expand Down
28 changes: 11 additions & 17 deletions src/templ-payloads.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct Payload2 {

struct NmapPayloads {
unsigned count;
unsigned max;
size_t max;
struct Payload **list;
};

Expand All @@ -64,21 +64,15 @@ struct Payload2 hard_coded_payloads[] = {
"\x30\x0d"
"\x06\x09\x2b\x06\x01\x80\x02\x01\x01\x05\x00" /*sysDesc*/
"\x05\x00"}, /*^^^^_____IDS LULZ HAH HA HAH*/
{53, 65536, 39, 0, dns_set_cookie,
"\x50\xb6" /* transaction id */
"\x01\x20" /* quer y*/
"\x00\x01" /* query = 1 */
"\x00\x00\x00\x00\x00\x00"
"\x07" "version" "\x04" "bind" "\xc0\x08"
"\x00\x10" /* TXT */ /*^^^^^^^^_____IDS LULZ HAH HA HAH*/
"\x00\x03" /* CHAOS */


"\x00\x00" /* transaction ID */
"\x01\x00" /* standard query */
"\x00\x01\x00\x00\x00\x00\x00\x00" /* 1 query */
"\x03" "www" "\x05" "yahoo" "\x03" "com" "\x00"
"\x00\x01\x00\x01" /* A IN */
{53, 65536, 0x1f+8, 0, dns_set_cookie,
/* 00 */"\x50\xb6" /* transaction id */
/* 02 */"\x01\x20" /* quer y*/
/* 04 */"\x00\x01" /* query = 1 */
/* 06 */"\x00\x00\x00\x00\x00\x00"
/* 0c */"\x07" "version" "\x04" "bind" "\xc0\x1b"
/* 1b */"\x00\x10" /* TXT */ /*^^^^^^^_____IDS LULZ HAH HA HAH*/
/* 1d */"\x00\x03" /* CHAOS */
/* 1f */
},
{137, 65536, 50, 0, dns_set_cookie,
"\xab\x12" /* transaction id */
Expand Down Expand Up @@ -413,7 +407,7 @@ payload_add(struct NmapPayloads *payloads,
for (i=0; i<port_count; i++) {
/* grow the list if we need to */
if (payloads->count + 1 > payloads->max) {
unsigned new_max = payloads->max*2 + 1;
size_t new_max = payloads->max*2 + 1;
struct Payload **new_list;

if (new_max >= SIZE_MAX/sizeof(new_list[0]))
Expand Down

0 comments on commit b1d0d28

Please sign in to comment.