| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | "Ing(dot)Edmundo(dot)Robles(dot)Lopez" <erobles(at)sensacd(dot)com(dot)mx> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: OFFTOPIC: core dumped with strcpy,atoi,sprintf. |
| Date: | 2012-09-14 16:37:34 |
| Message-ID: | 15950.1347640654@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
"Ing.Edmundo.Robles.Lopez" <erobles(at)sensacd(dot)com(dot)mx> 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.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Yvon Thoraval | 2012-09-14 16:39:13 | Re: SQLSTATE[08006] [7] server closed the connection unexpectedly |
| Previous Message | Ing.Edmundo.Robles.Lopez | 2012-09-14 16:14:56 | OFFTOPIC: core dumped with strcpy,atoi,sprintf. |