-#include "squid.h"
+/*
+ * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
/* UNIX SMBlib NetBIOS implementation
SMBlib Utility Routines
Copyright (C) Richard Sharpe 1996
-
*/
/*
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "smblib/smblib.h"
-#include "smblib/smblib-priv.h"
+#include "squid.h"
#include "rfcnb/rfcnb.h"
+#include "smblib/smblib-priv.h"
+#include "smblib/smblib.h"
#if HAVE_STRING_H
#include <string.h>
{
int i;
- if (dialects == SMB_Prots) { /* The jobs is easy, just index into table */
+ // prot_index may be a value outside the table SMB_Types[]
+ // which holds data at offsets 0 to 11
+ int ourType = (prot_index < 0 || prot_index > 11);
+
+ if (ourType && dialects == SMB_Prots) { /* The jobs is easy, just index into table */
return(SMB_Types[prot_index]);
} else { /* Search through SMB_Prots looking for a match */
p = (SMB_Hdr(pkt) + SMB_negrLM_buf_offset + Con_Handle -> Encrypt_Key_Len);
- strncpy(p, Con_Handle -> Svr_PDom, sizeof(Con_Handle -> Svr_PDom) - 1);
+ xstrncpy(p, Con_Handle -> Svr_PDom, sizeof(Con_Handle -> Svr_PDom));
break;
p = (SMB_Hdr(pkt) + SMB_negrLM_buf_offset + Con_Handle -> Encrypt_Key_Len);
- strncpy(p, Con_Handle -> Svr_PDom, sizeof(Con_Handle -> Svr_PDom) - 1);
+ xstrncpy(p, Con_Handle -> Svr_PDom, sizeof(Con_Handle -> Svr_PDom));
break;
tree -> next = tree -> prev = NULL;
tree -> con = Con_Handle;
- strncpy(tree -> path, path, sizeof(tree -> path));
- strncpy(tree -> device_type, device, sizeof(tree -> device_type));
+ xstrncpy(tree -> path, path, sizeof(tree -> path));
+ xstrncpy(tree -> device_type, device, sizeof(tree -> device_type));
/* Now plug in the values ... */
}
}
+