473,563 Members | 2,668 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

(part 2) posible minour buggs in dick heathfields book

hay, Han frm china heer again...
ben readin sum more c unleashed book dick heathfields book...
still readin dick heathfields data structs cht but jumped ahead
to chad dixons cgi proggraming cht out of interest for
bit varietty... hard to focuss on length of data structs cht
vry drawn out longwindded imho...

small robusttness patch for pg. 400 DlExchange() function:

int DLExchange(DLLI ST *ItemA, DLLIST *ItemB)
{
//...
- if(ItemA != NULL && ItemB != NULL)
- {
- if(ItemA->next == ItemB)
+ if(ItemA != NULL && ItemB != NULL)
+ {
+ if(ItemA == ItemB)
+ {
+ Result = DL_SAME_ITEM;
+ }
+ else if(ItemA->next == ItemB)

this stopp function wrking on same item, witch wuld
cause one-node loop & corruptt double lst...

now for cgi cht.. witch also still reading... hope
to read entire bk lerning lot much frm the c exprtts

cgi cht has section on seccurity for cgi but has
seccurity prob in its own ReadCGIData() funct...
also not in c unleashed erata...

plz, bear wit me hear, this about to get vry complexx

size_t Size = 0;
//...
ContentLength = getenv("CONTENT _LENGTH");
//...
Size = (size_t)atoi(Co ntentLength);
if(Size <= 0)
{
*Error = CGI_BAD_CONTENT _LENGTH;
}
//...
++Size;
Buffer = malloc(Size);
if(NULL == Buffer)
//...
if(NULL == fgets(Buffer, Size, stdin))

//... bang!

it is posible set Size to size_t max value (assume
size_t unsigned) with ContentLength of -1.
i.e., have look at my code...

size_t j;
j = (size_t)atoi("-1");
printf("%lu\n", (unsigned long)j);

many web server hapily acceppt -1 ContentLength

this max value then pass test
if(Size <= 0)

then ++Size make max value wrap to 0

then following code may not fail
Buffer = malloc(Size);
if(NULL == Buffer)

[H&S 16.1: "If the requested size is 0, then the Standard
C functions will return either a null pointer or a non-null
pointer that nevertheless must not be used to access an
object."]

what importtant is that malloc(0) may not return NULL...
on, fe., glibc malloc allocator based on doug lea malloc,
malloc(0) allocatte minimum chunk... this malloc allocator
store importtant bookkeepin info at end of chunk...

then,
fgets(Buffer, Size, stdin)

use max value Size to overrun malloc chunk up to next
newline, corrupttin memory, introducin deadly securrity
issue

i, Han, certtainly not ussin c unleashed cgi library
on my web server.......
starttin feel angry bout c unleashed book purrchase,
feelin as tho bought anotther Herb Schildt book....

Il mittente di questo messaggio|The sender address of this
non corrisponde ad un utente |message is not related to a real
reale ma all'indirizzo fittizio|person but to a fake address of an
di un sistema anonimizzatore |anonymous system
Per maggiori informazioni |For more info
https://www.mixmaster.it

Oct 28 '08 #1
3 1753
George Orwell wrote:
hay, Han frm china heer again...
ben readin sum more c unleashed book dick heathfields book...
still readin dick heathfields data structs cht but jumped ahead
to chad dixons cgi proggraming cht out of interest for
bit varietty... hard to focuss on length of data structs cht
vry drawn out longwindded imho...
[...]
Would you mind changing your E-mail alias? George Orwell
(aka Eric Arthur Blair) was devoted to clear writing, to almost
mercilessly clear writing that left the reader no option other
than to understand what was written. Since the aesthetic of
your writing is diametrically opposed to his, it is an insult
to his memory for you to misappropriate his nom de plume.

--
Er*********@sun .com
Oct 28 '08 #2
George Orwell wrote:
hay, Han frm china heer again...
No, you're apparently a randomly morphing troll.
Oct 28 '08 #3
On 28 Oct, 18:44, George Orwell <nob...@mixmast er.itwrote:
hay, Han frm china heer again...
ben readin sum more c unleashed book dick heathfields book...
still readin dick heathfields data structs cht but jumped ahead
to chad dixons cgi proggraming cht out of interest for
bit varietty... hard to focuss on length of data structs cht
vry drawn out longwindded imho...
<snip>

If you have a point to make then post it in english.
I can't be bothered to read the gibberish you post.

--
Nick Keighley
Oct 29 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1183
by: sparks | last post by:
tempname = FindSpaces(rs!) this works fine but if I try to pass a variable value to it For i = 1 To 3 Step 2 tempname = FindSpaces(rs!) why can't the variable i just be used in this way? Is it because of the space in the name column 1 or is it something else?
17
2204
by: sophia.agnes | last post by:
Hi , I was going through peter van der linden's book Expert C programming, in this book there is a section named "How and why to cast" the author then says as follows (float) 3 - it's a type conversion and the actual bits change. if you say (float) 3.0 it is a type disambiguation,and the compiler can plant the correct bits in the first...
43
1837
by: sophia.agnes | last post by:
Hi, I was going through Mr "Richard heathfields" site , it is written as follows:- Some people think C has no role to play in the modern programming world. I would consider this opinion to have rather more validity if it weren't for the fact that even those who express it use C code on a daily basis (whether they realise it or not). C...
0
1322
by: Nomen Nescio | last post by:
hay, student proggramer 19 yrs old china in computer course ben doing c proggraming cpl of months from pascal backgrond enjoyying c unleashed book posible minour buggs found in dick heathfields data structs cht buggs not on c unleashed erata witch i looked throughly grate book lerning lot frmo the c expertts pg. 348 double Loading = {0};
8
1502
by: Nomen Nescio | last post by:
Hey, this is Ajun from a Bangladesh outsource company. Han has hired me to do the English writing for his comp.lang.c posts. The subject line has been changed, which may affect archival consistency, so if you're looking for the first two installments of this series, just run a Google Groups search for "posible minour buggs in dick heathfields...
4
1473
by: Nomen Nescio | last post by:
No errors to report here. It's hard work taking the nitpick microscope to the CLC Clique's book, but someone has to do it. It's occurred to me I haven't properly introduced myself. /* * 5-1-2-2-3.c * Han from China's hello-CLC program. *
8
1379
by: Borked Pseudo Mailed | last post by:
Richard Heathfield said: <snip> From swab.c: void swab(const void * __restrict from, void * __restrict to, ssize_t len) { unsigned long temp;
1
1413
by: Borked Pseudo Mailed | last post by:
Hey, guys. I'm still plowing through Dick Heathfield's data-structures chapter. It's like reading 100-plus pages on how to core an apple, but I'm getting there, slowly. I'm up to his HTML syntax checker in the stacks section. Noticed a corker of an error in that, but I'll leave that for one of my next posts, at which point I hope to finish...
5
1553
by: Chris M. Thomasson | last post by:
"George Orwell" <nobody@mixmaster.itwrote in message news:c6eb564c3d719950dc8bd7151040c449@mixmaster.it... Do you really think a single book provides enough weight for proper workout paraphernalia? You must be a real weakling; oh well.
0
7664
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7885
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7638
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7948
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3642
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.