diff options
author | H. Peter Anvin <hpa@zytor.com> | 1998-11-03 21:05:14 +0000 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 1998-11-03 21:05:14 +0000 |
commit | ec7f298383d65942782f5c0652e38331cb3a2633 (patch) | |
tree | 79ba1dbb21f02d9b19e646db285f2113d65a31c0 /modules | |
parent | b275c465162438a72d95b7118376410ceb8f4850 (diff) | |
download | autofs3-ec7f298383d65942782f5c0652e38331cb3a2633.tar.gz autofs3-ec7f298383d65942782f5c0652e38331cb3a2633.tar.xz autofs3-ec7f298383d65942782f5c0652e38331cb3a2633.zip |
Null pointer fix for mount_smbfs.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/mount_smbfs.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/modules/mount_smbfs.c b/modules/mount_smbfs.c index 811fe8d..472b961 100644 --- a/modules/mount_smbfs.c +++ b/modules/mount_smbfs.c @@ -7,7 +7,7 @@ * * Mount point input format expected is: //server/service[/root_path...] * - * Copyright 1997 Transmeta Corporation - All Rights Reserved + * Copyright 1997-1998 Transmeta Corporation - All Rights Reserved * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -136,14 +136,21 @@ int mount_mount(const char *root, const char *name, int name_len, const char **argv; fullpath = alloca(strlen(root)+name_len+2); - optcopy = alloca(optsize = strlen(options)+1); - if ( !fullpath || !optcopy ) { + if (options) + optcopy = alloca(optsize = strlen(options)+1); + else { + optsize = 0; + optcopy = NULL; + } + if ( !fullpath || (!optcopy && optsize)) { syslog(LOG_ERR, MODPREFIX "alloca: %m"); return 1; } sprintf(fullpath, "%s/%s", root, name); - memcpy(optcopy, options, optsize); + if (optsize) + memcpy(optcopy, options, optsize); + argc = smb_parse_options(optcopy, NULL, NULL, &qbuflen) + 4; argv = alloca(sizeof(char *) * argc); qbuf = alloca(qbuflen); @@ -154,7 +161,8 @@ int mount_mount(const char *root, const char *name, int name_len, argv[0] = PATH_SMBMOUNT; argv[1] = what; argv[2] = fullpath; - memcpy(optcopy, options, optsize); + if (optsize) + memcpy(optcopy, options, optsize); smb_parse_options(optcopy, argv+3, qbuf, NULL); syslog(LOG_DEBUG, MODPREFIX "calling mkdir %s", fullpath); |