summaryrefslogtreecommitdiffstats
path: root/source/libsmb/nmblib.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/libsmb/nmblib.c')
-rw-r--r--source/libsmb/nmblib.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/libsmb/nmblib.c b/source/libsmb/nmblib.c
index 54f34cc233a..95d124c0208 100644
--- a/source/libsmb/nmblib.c
+++ b/source/libsmb/nmblib.c
@@ -1119,7 +1119,11 @@ char *dns_to_netbios_name(char *dns_name)
netbios name up to and including the '.' this even applies, by
mistake, to workgroup (domain) names, which is _really_ daft.
*/
- for (i = 15; i >= 0; i--)
+ /*
+ * We need to go up, not down, to avoid netbios names like
+ * fred.xyz being produced from fred.xyz.someco.com.
+ */
+ for (i = 0; i < 15; i++)
{
if (netbios_name[i] == '.')
{