summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-11-07 22:43:54 +0000
committerJeremy Allison <jra@samba.org>2002-11-07 22:43:54 +0000
commit72b7cfe4f14abfc553072bf341196ec98b0d40d6 (patch)
tree6435e784e22dac11074861bafca54f89179ed0ca
parent2446d245df2acecb0b3babe5aee08181111b7a17 (diff)
downloadsamba-72b7cfe4f14abfc553072bf341196ec98b0d40d6.tar.gz
samba-72b7cfe4f14abfc553072bf341196ec98b0d40d6.tar.bz2
samba-72b7cfe4f14abfc553072bf341196ec98b0d40d6.zip
Fix crash bug with overwriting malloced memory.
Jeremy. (This used to be commit 3228730c8311ec6507227f8936318b1d965c1228)
-rw-r--r--source3/printing/printing.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 6d4cc213a7..71e09c793f 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -1111,7 +1111,7 @@ BOOL print_notify_pid_list(const char *printername, TALLOC_CTX *mem_ctx, size_t
struct tdb_print_db *pdb;
TDB_DATA data;
BOOL ret = True;
- size_t i, num_pids;
+ size_t i, num_pids, offset;
pid_t *pid_list;
*p_num_pids = 0;
@@ -1141,10 +1141,8 @@ BOOL print_notify_pid_list(const char *printername, TALLOC_CTX *mem_ctx, size_t
goto done;
}
- for( i = 0; i < data.dsize; i += 8) {
- pid_t pid = (pid_t)IVAL(data.dptr, i);
- pid_list[i] = pid;
- }
+ for( i = 0, offset = 0; offset < data.dsize; offset += 8, i++)
+ pid_list[i] = (pid_t)IVAL(data.dptr, offset);
*pp_pid_list = pid_list;
*p_num_pids = num_pids;