#71 Safer code

开启中
nuclearkev10 月之前创建 · 1 条评论

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"); } ```
登录 并参与到对话中。
正在加载...
取消
保存
这个人很懒,什么都没留下。