--- maelstrom-1.4.3-L3.0.6.orig/myerror.cpp
+++ maelstrom-1.4.3-L3.0.6/myerror.cpp
@@ -10,34 +10,34 @@
#include <errno.h>
-void error(char *fmt, ...)
+void error(const char *fmt, ...)
{
char mesg[BUFSIZ];
va_list ap;
va_start(ap, fmt);
- vsprintf(mesg, fmt, ap);
+ vsnprintf(mesg, BUFSIZ, fmt, ap);
fputs(mesg, stderr);
va_end(ap);
}
-void mesg(char *fmt, ...)
+void mesg(const char *fmt, ...)
{
char mesg[BUFSIZ];
va_list ap;
va_start(ap, fmt);
- vsprintf(mesg, fmt, ap);
+ vsnprintf(mesg, BUFSIZ, fmt, ap);
fputs(mesg, stdout);
va_end(ap);
}
-void myperror(char *msg)
+void myperror(const char *msg)
{
char buffer[BUFSIZ];
if ( *msg ) {
- sprintf(buffer, "%s: %s\n", msg, strerror(errno));
+ snprintf(buffer, BUFSIZ, "%s: %s\n", msg, strerror(errno));
error(buffer);
} else
error((char *)strerror(errno));