🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #11790

Re: Segmentation fault

#11790
From: Jesús Carrete Montaña
Date: Fri, 05 Oct 2001 17:25
28 lines
2239 bytes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

>>>>> "X" == X  <x@xxx.com> writes:

    >> .name apunta a una direcci�n de memoria cualquiera, no a una en
    >> la que hayas reservado memoria expl�citamente con malloc. Es
    >> como una rray de tama�o 0. Al intentar meter "Jamoncito\n" en
    >> �l escribes en memoria no reservada y da segfault.

    X> Ya que nos ponemos...  �Y como hago para saber el tama�o
    X> alojado en un puntero, si lo �nico que tengo es el puntero?

        Pues bien sencillo, como no has reservado nada el tama�o es
0. Utiliza malloc() para pedir una cantidad determinada de memoria y
si el c�digo de retorno no es NULL sabr�s que tienes reservada la
cantidad que has pedido. O bien declara directamente un array de char
de tama�o fijo.

Un saludo.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.6 and Gnu Privacy Guard <http://www.gnupg.org/>

iD8DBQE7vezwfUtQQKOnZ1IRAt10AKC0CZvousb7iuzKC2J2L989bRXv3wCg4vEY
PNOnJWRV+9raBVvyi1ek3Gw=
=Jd93
-----END PGP SIGNATURE-----
Technical Details
Message-ID: <878zeqyp6r.fsf@relativistic.ion>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!uni-berlin.de!31-coru-x6.libre.retevision.ES!not-for-mail
References: <lnhip9.bq.ln@xxx.com> <87lmirknsk.fsf@meltdown.ion> <44ejp9.3f1.ln@xxx.com>

Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII
X-Google-Thread: f86c8,b3c8decf211f42e0
X-Google-Attributes: gidf86c8,public
X-Google-ArrivalTime: 2001-10-05 10:30:23 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!fu-berlin.de!uni-berlin.de!31-coru-x6.libre.retevision.ES!not-for-mail
From: kuantiko@escomposlinux.org (Jesús Carrete
  Montaña)
Newsgroups: es.comp.os.linux.programacion
Subject: Re: Segmentation fault
Date: 05 Oct 2001 19:25:16 +0200
Lines: 28
Sender: kuantiko@relativistic.ion
Message-ID: <878zeqyp6r.fsf@relativistic.ion>
References: <lnhip9.bq.ln@xxx.com> <87lmirknsk.fsf@meltdown.ion> <44ejp9.3f1.ln@xxx.com>
NNTP-Posting-Host: 31-coru-x6.libre.retevision.es (62.83.55.31)
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: fu-berlin.de 1002303019 19989942 62.83.55.31 (16 [54696])
X-Orig-Path: relativistic.homeip.net!nobody
User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7