From 61b5fd6f32e9ccb612df1354a3e3b3bed5f2b808 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 31 Aug 1998 03:11:42 +0000 Subject: bounds check next_token() to prevent possible buffer overflows (This used to be commit 3eade55dc7c842bdc50205c330802d211fae54d3) --- source3/libsmb/namequery.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source3/libsmb') diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index 8b0d68ce6a..5e189020ad 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -347,13 +347,13 @@ BOOL getlmhostsent( FILE *fp, char *name, int *name_type, struct in_addr *ipaddr ptr = line; - if (next_token(&ptr,ip ,NULL)) + if (next_token(&ptr,ip ,NULL,sizeof(ip))) ++count; - if (next_token(&ptr,name ,NULL)) + if (next_token(&ptr,name ,NULL, sizeof(name))) ++count; - if (next_token(&ptr,flags,NULL)) + if (next_token(&ptr,flags,NULL, sizeof(flags))) ++count; - if (next_token(&ptr,extra,NULL)) + if (next_token(&ptr,extra,NULL, sizeof(extra))) ++count; if (count <= 0) @@ -452,7 +452,7 @@ BOOL resolve_name(char *name, struct in_addr *return_ip) ptr = name_resolve_list; if (!ptr || !*ptr) ptr = "host"; - while (next_token(&ptr, tok, LIST_SEP)) { + while (next_token(&ptr, tok, LIST_SEP, sizeof(tok))) { if(strequal(tok, "host") || strequal(tok, "hosts")) { /* -- cgit