Opened 13 years ago

Closed 13 years ago

#134 closed defect (fixed)

sizeof(NGX_INT32_LEN) triggers out of memory

Reported by: Vincent Lee Owned by: somebody
Priority: major Milestone: 1.2.0
Component: other Version: 1.1.x
Keywords: out of memory Cc:
uname -a: windows
nginx -V: nginx version: nginx/1.1.16

Description

FILE:nginx/trunk/src/os/win32/ngx_shmem.c, LINES:18

Index: ngx_shmem.c
===================================================================
--- ngx_shmem.c (revision 4567)
+++ ngx_shmem.c (working copy)
@@ -15,7 +15,7 @@

u_char *name;
uint64_t size;


  • name = ngx_alloc(shm->name.len + 2 + sizeof(NGX_INT32_LEN), shm->log);

+ name = ngx_alloc(shm->name.len + 2 + NGX_INT32_LEN, shm->log);

if (name == NULL) {

return NGX_ERROR;

}

the NGX_INT32_LEN finger out the length of INT32 string. don't need to sizeof again.
if call sizeof again, ngx_alloc will get a smaller buffer, and then will be out of memory.

Attachments (1)

ngx_shmem.c.patch (422 bytes ) - added by Vincent Lee 13 years ago.
svn path

Download all attachments as: .zip

Change History (8)

by Vincent Lee, 13 years ago

Attachment: ngx_shmem.c.patch added

svn path

comment:1 by Ruslan Ermilov, 13 years ago

Status: newaccepted

comment:2 by Maxim Dounin, 13 years ago

In [4571/nginx]:

(The changeset message doesn't reference this ticket)

comment:3 by Maxim Dounin, 13 years ago

Fix committed, thanks. Could you please provide proper english transcription of you name (for CHANGES)?

in reply to:  3 comment:4 by Vincent Lee, 13 years ago

Replying to Maxim Dounin:

Fix committed, thanks. Could you please provide proper english transcription of you name (for CHANGES)?

i cannot find where to set my english name, it seems that this name is fetched from google+. i have modified my english name to vincent.lee at the Preferences.

Last edited 13 years ago by Vincent Lee (previous) (diff)

comment:5 by Maxim Dounin, 13 years ago

We usually provide properly capitalized full names in CHANGES. Is "Vincent Lee" looks ok?

in reply to:  5 comment:6 by Vincent Lee, 13 years ago

Replying to Maxim Dounin:

We usually provide properly capitalized full names in CHANGES. Is "Vincent Lee" looks ok?

ok,thanks.

comment:7 by Maxim Dounin, 13 years ago

Resolution: fixed
Status: acceptedclosed

Thanks, closing this now.

Note: See TracTickets for help on using tickets.