diff options
author | Omar Polo <op@omarpolo.com> | 2024-06-10 08:20:35 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2024-06-10 08:20:35 +0000 |
commit | cf6269349513c87a6660d9e5bb8c2d20e628d195 (patch) | |
tree | 16a2067d1fb398628f691abc5ce5f73b4dcc527d /gg.c | |
parent | 62aa1935cc563f864635bb9ee0b1204752168fe6 (diff) |
gg: use snprintf
Diffstat (limited to 'gg.c')
-rw-r--r-- | gg.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -213,14 +213,13 @@ get(const char *r) char req[GEMINI_URL_LEN]; uint8_t buf[2048]; const char *parse_err, *host, *port; + int ret; if (strlcpy(iribuf, r, sizeof(iribuf)) >= sizeof(iribuf)) errx(1, "iri too long: %s", r); - if (strlcpy(req, r, sizeof(req)) >= sizeof(req)) - errx(1, "iri too long: %s", r); - - if (strlcat(req, "\r\n", sizeof(req)) >= sizeof(req)) + ret = snprintf(req, sizeof(req), "%s\r\n", r); + if (ret < 0 || (size_t)ret >= sizeof(req)) errx(1, "iri too long: %s", r); if (!parse_iri(iribuf, &iri, &parse_err)) |