Commit Diff


commit - 7d1d97775f953cdc603a85c6b160332f02d223b2
commit + 15decef243429c2973b338ff3b01f95ac90dd555
blob - 82914989013d5b361105e4b671c007f0f88a7eca
blob + c0adc9a4d6cd60a5a1e02f905f1f47dd6bb1e37c
--- ctl.c
+++ ctl.c
@@ -91,10 +91,11 @@ canonpath(const char *input, char *buf, size_t bufsize
 {
 	const char *p;
 	char *q, path[PATH_MAX];
+	int r;
 
 	if (input[0] != '/') {
-		if (snprintf(path, sizeof(path), "%s/%s", cwd, input)
-		    >= sizeof(path)) {
+		r = snprintf(path, sizeof(path), "%s/%s", cwd, input);
+		if (r < 0 || (size_t)r >= sizeof(path)) {
 			errno = ENAMETOOLONG;
 			return -1;
 		}