diff options
-rw-r--r-- | source3/client/client.c | 8 | ||||
-rw-r--r-- | source3/lib/snprintf.c | 1 | ||||
-rw-r--r-- | source3/nsswitch/winbindd_cm.c | 10 | ||||
-rw-r--r-- | source3/passdb/pdb_tdb.c | 12 | ||||
-rw-r--r-- | source3/rpcclient/cmd_spoolss.c | 10 |
5 files changed, 24 insertions, 17 deletions
diff --git a/source3/client/client.c b/source3/client/client.c index f1059f8ee1..eb9750299b 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -1343,7 +1343,7 @@ static int cmd_mput(void) /* if (!recurse) continue; */ SAFE_FREE(quest); - asprintf(&quest, "Put directory %s? ", lname); + if (asprintf(&quest, "Put directory %s? ", lname) < 0) break; if (prompt && !yesno(quest)) { /* No */ /* Skip the directory */ lname[strlen(lname)-1] = '/'; @@ -1351,7 +1351,7 @@ static int cmd_mput(void) break; } else { /* Yes */ SAFE_FREE(rname); - asprintf(&rname, "%s%s", cur_dir, lname); + if(asprintf(&rname, "%s%s", cur_dir, lname) < 0) break; dos_format(rname); if (!cli_chkpath(cli, rname) && !do_mkdir(rname)) { @@ -1365,13 +1365,13 @@ static int cmd_mput(void) continue; } else { SAFE_FREE(quest); - asprintf(&quest,"Put file %s? ", lname); + if (asprintf(&quest,"Put file %s? ", lname) < 0) break; if (prompt && !yesno(quest)) /* No */ continue; /* Yes */ SAFE_FREE(rname); - asprintf(&rname, "%s%s", cur_dir, lname); + if (asprintf(&rname, "%s%s", cur_dir, lname) < 0) break; } dos_format(rname); diff --git a/source3/lib/snprintf.c b/source3/lib/snprintf.c index 88eea2824b..9a9dcdbae1 100644 --- a/source3/lib/snprintf.c +++ b/source3/lib/snprintf.c @@ -803,6 +803,7 @@ static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c) va_list ap; int ret; + *ptr = NULL; va_start(ap, format); ret = vasprintf(ptr, format, ap); va_end(ap); diff --git a/source3/nsswitch/winbindd_cm.c b/source3/nsswitch/winbindd_cm.c index 013289ed13..5d6c758e10 100644 --- a/source3/nsswitch/winbindd_cm.c +++ b/source3/nsswitch/winbindd_cm.c @@ -712,10 +712,12 @@ static void dump_conn_list(void) /* Display pipe info */ - asprintf(&msg, "\t%-15s %-15s %-16s", con->domain, con->controller, con->pipe_name); - - DEBUG(0, ("%s\n", msg)); - free(msg); + if (asprintf(&msg, "\t%-15s %-15s %-16s", con->domain, con->controller, con->pipe_name) < 0) { + DEBUG(0, ("Error: not enough memory!\n")); + } else { + DEBUG(0, ("%s\n", msg)); + SAFE_FREE(msg); + } } } diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c index 1f234edc93..b33e684c7a 100644 --- a/source3/passdb/pdb_tdb.c +++ b/source3/passdb/pdb_tdb.c @@ -488,13 +488,13 @@ BOOL pdb_getsampwent(SAM_ACCOUNT *user) sam_user = pdb_get_username(user); pstrcpy(sam_subst, pdb_get_logon_script(user)); standard_sub_advanced(-1, sam_user, "", gid, sam_user, sam_subst); - pdb_set_logon_script(user, sam_subst, True); + if (!pdb_set_logon_script(user, sam_subst, True)) return False; pstrcpy(sam_subst, pdb_get_profile_path(user)); standard_sub_advanced(-1, pdb_get_username(user), "", gid, pdb_get_username(user), sam_subst); - pdb_set_profile_path(user, sam_subst, True); + if (!pdb_set_profile_path(user, sam_subst, True)) return False; pstrcpy(sam_subst, pdb_get_homedir(user)); standard_sub_advanced(-1, pdb_get_username(user), "", gid, pdb_get_username(user), sam_subst); - pdb_set_homedir(user, sam_subst, True); + if (!pdb_set_homedir(user, sam_subst, True)) return False; /* increment to next in line */ global_tdb_ent.key = tdb_nextkey(global_tdb_ent.passwd_tdb, global_tdb_ent.key); @@ -578,13 +578,13 @@ BOOL pdb_getsampwnam (SAM_ACCOUNT *user, const char *sname) sam_user = pdb_get_username(user); pstrcpy(sam_subst, pdb_get_logon_script(user)); standard_sub_advanced(-1, sam_user, "", gid, sam_user, sam_subst); - pdb_set_logon_script(user, sam_subst, True); + if (!pdb_set_logon_script(user, sam_subst, True)) return False; pstrcpy(sam_subst, pdb_get_profile_path(user)); standard_sub_advanced(-1, pdb_get_username(user), "", gid, pdb_get_username(user), sam_subst); - pdb_set_profile_path(user, sam_subst, True); + if (!pdb_set_profile_path(user, sam_subst, True)) return False; pstrcpy(sam_subst, pdb_get_homedir(user)); standard_sub_advanced(-1, pdb_get_username(user), "", gid, pdb_get_username(user), sam_subst); - pdb_set_homedir(user, sam_subst, True); + if (!pdb_set_homedir(user, sam_subst, True)) return False; } else { DEBUG(0,("pdb_getsampwent: getpwnam(%s) return NULL. User does not exist!\n", diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c index ed65632344..f0e6af9822 100644 --- a/source3/rpcclient/cmd_spoolss.c +++ b/source3/rpcclient/cmd_spoolss.c @@ -1183,11 +1183,15 @@ static NTSTATUS cmd_spoolss_getprintprocdir(struct cli_state *cli, return NT_STATUS_OK; } - asprintf(&servername, "\\\\%s", cli->desthost); + if (asprintf(&servername, "\\\\%s", cli->desthost) < 0) + return NT_STATUS_NO_MEMORY; strupper(servername); - asprintf(&environment, "%s", (argc == 3) ? argv[2] : - PRINTER_DRIVER_ARCHITECTURE); + if (asprintf(&environment, "%s", (argc == 3) ? argv[2] : + PRINTER_DRIVER_ARCHITECTURE) < 0) { + SAFE_FREE(servername); + return NT_STATUS_NO_MEMORY; + } result = cli_spoolss_getprintprocessordirectory( cli, mem_ctx, servername, environment, procdir); |