X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=dotlock.c;h=4dea19687e372751ffcd077a2b0d1bbf17724042;hp=c076a4b654067a62d65e1d21f8b58d1286c9c2aa;hb=8405d0fd3a83943d112b4a180cea3fc318a28a01;hpb=c3e57678c8be193fc137854020f3a90887be97c9 diff --git a/dotlock.c b/dotlock.c index c076a4b..4dea196 100644 --- a/dotlock.c +++ b/dotlock.c @@ -126,6 +126,10 @@ static int dotlock_lock (const char *); #define check_flags(a) if (a & DL_FL_ACTIONS) usage (argv[0]) +size_t safe_strlen (const char* s) { + return (s ? strlen (s) : 0); +} + int main (int argc, char **argv) { int i; @@ -449,7 +453,7 @@ static int dotlock_prepare (char *bn, size_t l, const char *f, int _fd) dirname = "."; } - if (strlen (basename) + 1 > l) + if (safe_strlen (basename) + 1 > l) return -1; strfcpy (bn, basename, l);