[patch] fix schnorr vasprintf warnings on openssh-SNAP-20130304
g.esp at free.fr
g.esp at free.fr
Mon Mar 4 09:43:07 EST 2013
Tested against openssh-SNAP-2013-03-04
Fix those 2 old warnings
schnorr.c: In function 'debug3_bn':
schnorr.c:494: warning: ignoring return value of 'vasprintf', declared with attribute warn_unused_result
schnorr.c: In function 'debug3_buf':
schnorr.c:519: warning: ignoring return value of 'vasprintf', declared with attribute warn_unused_result
vasprintf return value should be checked.
If an error happen, -1 is returned and first parameter is undefined
--- openssh/schnorr.c.orig 2010-12-04 23:00:30.000000000 +0100
+++ openssh/schnorr.c 2013-03-03 23:35:11.000000000 +0100
@@ -491,10 +491,9 @@
out = NULL;
va_start(args, fmt);
- vasprintf(&out, fmt, args);
- va_end(args);
- if (out == NULL)
+ if (vasprintf(&out, fmt, args) == -1)
fatal("%s: vasprintf failed", __func__);
+ va_end(args);
if (n == NULL)
debug3("%s(null)", out);
@@ -516,10 +515,9 @@
out = NULL;
va_start(args, fmt);
- vasprintf(&out, fmt, args);
- va_end(args);
- if (out == NULL)
+ if (vasprintf(&out, fmt, args) == -1)
fatal("%s: vasprintf failed", __func__);
+ va_end(args);
debug3("%s length %u%s", out, len, buf == NULL ? " (null)" : "");
free(out);
Gilles
More information about the openssh-unix-dev
mailing list