Documentation Source Text

Check-in [e9a50836bc]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix a memory allocation error in CGI handling of althttpd.c.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e9a50836bc7a3f4b03fe8277fb930f06328508a66b019ac760200c631720ee2d
User & Date: drh 2020-03-25 11:25:05.525
Context
2020-03-30
13:05
Updates to the speed-and-size chart. (check-in: ff60a85843 user: drh tags: trunk)
2020-03-25
11:25
Fix a memory allocation error in CGI handling of althttpd.c. (check-in: e9a50836bc user: drh tags: trunk)
2020-03-20
12:44
Provide more accurate elapse time measurements in the output log of althttpd.c (check-in: f474634ac8 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to misc/althttpd.c.
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
  }
  if( seenContentLength ){
    nOut += printf("Content-length: %d\r\n\r\n", contentLength);
    xferBytes(in, stdout, contentLength, rangeStart);
  }else{
    while( (c = getc(in))!=EOF ){
      if( nRes>=nMalloc ){
        nMalloc = nMalloc*2;
        aRes = realloc(aRes, nMalloc+1);
        if( aRes==0 ){
           Malfunction(610, "Out of memory: %d bytes", nMalloc);
        }
      }
      aRes[nRes++] = c;
    }







|







1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
  }
  if( seenContentLength ){
    nOut += printf("Content-length: %d\r\n\r\n", contentLength);
    xferBytes(in, stdout, contentLength, rangeStart);
  }else{
    while( (c = getc(in))!=EOF ){
      if( nRes>=nMalloc ){
        nMalloc = nMalloc*2 + 1000;
        aRes = realloc(aRes, nMalloc+1);
        if( aRes==0 ){
           Malfunction(610, "Out of memory: %d bytes", nMalloc);
        }
      }
      aRes[nRes++] = c;
    }