From e1878a07e1cb7db24ca29962c7060bb862028fc3 Mon Sep 17 00:00:00 2001 From: Luke McCarthy Date: Wed, 10 Aug 2022 18:00:17 -0700 Subject: [PATCH] Avoid segfault on empty fastx file --- addon.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addon.c b/addon.c index 7f6d6c3..556753b 100644 --- a/addon.c +++ b/addon.c @@ -335,7 +335,9 @@ int bio_getrec(char **pbuf, int *psize, int isrecord) } } adjbuf(&buf, &bufsize, g_str.l + 1, recsize, 0, "bio_getrec"); - memcpy(buf, g_str.s, g_str.l + 1); + if (g_str.s) { + memcpy(buf, g_str.s, g_str.l + 1); + } if (c >= 0) { /* normal record */ if (isrecord) { if (freeable(fldtab[0]))