Search Postgresql Archives

Re: OFFTOPIC: core dumped with strcpy,atoi,sprintf.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 14, 2012 at 10:37 AM, Tom Lane <tgl@xxxxxxxxxxxxx> wrote:
> "Ing.Edmundo.Robles.Lopez" <erobles@xxxxxxxxxxxxxx> writes:
>> Debugging the program, found that the core is generated  by atoi,
>> sprintf and similar functions; because that functions fails when
>> received  a null pointer (NULL). But, if  the functions received  an
>> empty string ("") the program continues and run succesfully.
>
>> Yes,  I should validate each input pointers. But, its odd that works in
>> SCO and not in Linux, and its odder that fails in functions like strcpy,
>> atoi, sprintf, etc.
>
> Not really.  Per the POSIX spec, the behavior of those functions is
> undefined for NULL input pointers.  Some platforms are forgiving about
> it, most are not.

I learned C on a platform with no memory protection wherein a null
pointer would result in a write to location 0 and an immediate machine
crash.  Wow, that was a LONG time ago (late 80s).  Kids today.  Got it
easy.


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux