diff options
author | Jeremy Allison <jra@samba.org> | 2002-11-07 22:45:11 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2002-11-07 22:45:11 +0000 |
commit | e1adcd154a9e4371b48eac40f01ac0ffc8103953 (patch) | |
tree | e9194bf724404b0e10641e72ad62173cd25d7435 /source3 | |
parent | 4d70634685fcd5f6a0d18d8cf1ce6aa0ae3ce4b7 (diff) | |
download | samba-e1adcd154a9e4371b48eac40f01ac0ffc8103953.tar.gz samba-e1adcd154a9e4371b48eac40f01ac0ffc8103953.tar.bz2 samba-e1adcd154a9e4371b48eac40f01ac0ffc8103953.zip |
Fix crash bug with overwriting memory.
Jeremy.
(This used to be commit 9b08b4e4c24290e5d90a7cc2dc442cb82e73df28)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/printing/printing.c | 8 |
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; |