#71 Safer code

Offen
vor 10 Monaten geöffnet von nuclearkev · 1 Kommentare

After look at some of mg(1)'s code for reference, I discovered that there is a lot of code that I've written (and the previous 2 authors) that is kind of unsafe. Granted there are some things that don't really matter such as using sprintf(3) instead of asprintf(3) in the modeline but it would be nice to make sure that the memory is handle correctly.

I don't have this in a milestone because I don't know when I would do this.

After look at some of mg(1)'s code for reference, I discovered that there is a lot of code that I've written (and the previous 2 authors) that is kind of unsafe. Granted there are _some_ things that don't really matter such as using `sprintf(3)` instead of `asprintf(3)` in the modeline but it would be nice to make sure that the memory is handle correctly. I don't have this in a milestone because I don't know when I would do this.

While I've began part of this, it won't be completed for a long time. There are many uses of asprintf, str[n]dup, memcpy, and memccpy that aren't properly error checked. I'd like to make sure that any error like that is handle correctly, just in case. Something like what is below:

if((buf = strdup(str)) == NULL) {
  fatal("%s, out of memory");
}
While I've began part of this, it won't be completed for a long time. There are many uses of `asprintf`, `str[n]dup`, `memcpy`, and `memccpy` that aren't properly error checked. I'd like to make sure that any error like that is handle correctly, just in case. Something like what is below: ``` if((buf = strdup(str)) == NULL) { fatal("%s, out of memory"); } ```
Anmelden, um an der Diskussion teilzunehmen.
Laden…
Abbrechen
Speichern
Hier gibt es bis jetzt noch keinen Inhalt.