473,406 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

(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(DLLIST *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(ContentLength);
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 1743
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...@mixmaster.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
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...
17
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...
43
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...
0
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...
8
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...
4
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. /* *...
8
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
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...
5
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.