File readlink.diff of Package rpm

--- lib/rpmfi.c.orig	2012-12-18 17:44:38.000000000 +0000
+++ lib/rpmfi.c	2012-12-18 17:47:40.000000000 +0000
@@ -628,8 +628,10 @@ fileAction rpmfiDecideFate(const rpmfi o
 	const char * oFLink, * nFLink;
 	oFLink = rpmfiFLink(ofi);
 	if (diskWhat == LINK) {
-	if (readlink(fn, buffer, sizeof(buffer) - 1) == -1)
+	ssize_t link_len = readlink(fn, buffer, sizeof(buffer) - 1);
+	if (link_len == -1)
 	    return FA_CREATE;	/* assume file has been removed */
+	buffer[link_len] = '\0';
 	if (oFLink && !strcmp(oFLink, buffer))
 	    return FA_CREATE;	/* unmodified config file, replace. */
 	}
@@ -682,8 +684,10 @@ int rpmfiConfigConflict(const rpmfi fi)
 	    return 0;	/* unmodified config file */
     } else /* newWhat == LINK */ {
 	const char * nFLink;
-	if (readlink(fn, buffer, sizeof(buffer) - 1) == -1)
+	ssize_t link_len = readlink(fn, buffer, sizeof(buffer) - 1);
+	if (link_len == -1)
 	    return 0;	/* assume file has been removed */
+	buffer[link_len] = '\0';
 	nFLink = rpmfiFLink(fi);
 	if (nFLink && !strcmp(nFLink, buffer))
 	    return 0;	/* unmodified config file */