#include "../libcli/nbt/libnbt.h"
#include "param/param.h"
+#include <string.h>
+
+#define MAX_NETBIOSNAME_LEN 16
+
/* command line options */
static struct {
const char *broadcast_address;
struct socket_address *all_zero_addr;
struct nbt_name_socket *nbtsock;
NTSTATUS status = NT_STATUS_OK;
+ size_t nbt_len;
bool ret = true;
if (!options.case_sensitive) {
node_name = talloc_strdup(tmp_ctx, name);
}
+ nbt_len = strlen(node_name);
+ if (nbt_len > MAX_NETBIOSNAME_LEN - 1) {
+ printf("The specified netbios name [%s] is too long.\n",
+ node_name);
+ talloc_free(tmp_ctx);
+ return false;
+ }
+
nbtsock = nbt_name_socket_init(tmp_ctx, ev);
if (options.root_port) {
while(poptPeekArg(pc)) {
char *p;
struct in_addr ip;
+ size_t nbt_len;
fstrcpy(lookup,poptGetArg(pc));
sscanf(++p,"%x",&lookup_type);
}
+ nbt_len = strlen(lookup);
+ if (nbt_len > MAX_NETBIOSNAME_LEN - 1) {
+ d_printf("The specified netbios name [%s] is too long!\n",
+ lookup);
+ continue;
+ }
+
+
if (!query_one(lookup, lookup_type)) {
rc = 1;
d_printf( "name_query failed to find name %s", lookup );